<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <!-- hexo-inject:begin --><!-- hexo-inject:end --><meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#222" media="(prefers-color-scheme: dark)"><meta name="generator" content="Hexo 5.4.2">

  <link rel="apple-touch-icon" sizes="180x180" href="https://static.xiaosige.com/img/favicon.png">
  <link rel="icon" type="image/png" sizes="32x32" href="https://static.xiaosige.com/img/favicon.png">
  <link rel="icon" type="image/png" sizes="16x16" href="https://static.xiaosige.com/img/favicon.png">
  <link rel="mask-icon" href="https://static.xiaosige.com/img/favicon.png" color="#222">
  <meta name="baidu-site-verification" content="WZilU4QiSZ">

<link rel="stylesheet" href="/css/main.css">



<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.1/css/all.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0.31/dist/fancybox/fancybox.css" integrity="sha256-gkQVf8UKZgQ0HyuxL/VnacadJ+D2Kox2TCEBuNQg5+w=" crossorigin="anonymous">

<script class="next-config" data-name="main" type="application/json">{"hostname":"www.xiaosige.com","root":"/","images":"/images","scheme":"Gemini","darkmode":true,"version":"8.26.0","exturl":false,"sidebar":{"position":"left","width_expanded":320,"width_dual_column":240,"display":"post","padding":18,"offset":12},"hljswrap":false,"codeblock":{"theme":{"light":"atom-one-dark-reasonable","dark":"atom-one-dark-reasonable"},"prism":{"light":"prism-tomorrow","dark":"prism-tomorrow"},"copy_button":{"enable":true,"style":"mac"},"fold":{"enable":false,"height":500},"language":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":"changyan","storage":true,"lazyload":true,"nav":null,"activeClass":"changyan"},"stickytabs":false,"motion":{"enable":true,"async":false,"duration":200,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果：${query}","hits_time":"找到 ${hits} 个搜索结果（用时 ${time} 毫秒）","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"top_n_per_article":1,"unescape":false,"preload":true,"trigger":"auto"}}</script><script src="/js/config.js" defer></script>

    <meta name="description" content="介绍    Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown（或其他渲染引擎）解析文章，在几秒内，即可利用靓丽的主题生成静态网页。hexo 博客在 Linux 系统中搭建是非常简单的，在 WIN 系统中比较复杂，我们接触的手机📱永远要比电脑的时间要多那么我们可以在安卓手机上使用 termux 来搭建，这样随时随地都可以写做和发表文章。">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo之搭建个人博客">
<meta property="og:url" content="https://www.xiaosige.com/post/dfea82e5.html">
<meta property="og:site_name" content="小四儿">
<meta property="og:description" content="介绍    Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown（或其他渲染引擎）解析文章，在几秒内，即可利用靓丽的主题生成静态网页。hexo 博客在 Linux 系统中搭建是非常简单的，在 WIN 系统中比较复杂，我们接触的手机📱永远要比电脑的时间要多那么我们可以在安卓手机上使用 termux 来搭建，这样随时随地都可以写做和发表文章。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://www.xiaosige.com/post/dfea82e5/faviconbuild.png">
<meta property="og:image" content="https://www.xiaosige.com/post/dfea82e5/avatar_rotate_hover.gif">
<meta property="og:image" content="https://www.xiaosige.com/post/dfea82e5/avatar_rotate_normal.gif">
<meta property="article:published_time" content="2019-08-26T04:23:00.000Z">
<meta property="article:modified_time" content="2020-10-12T09:24:29.181Z">
<meta property="article:author" content="leeze">
<meta property="article:tag" content="hexo">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://www.xiaosige.com/post/dfea82e5/faviconbuild.png">


<link rel="canonical" href="https://www.xiaosige.com/post/dfea82e5.html">


<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"https://www.xiaosige.com/post/dfea82e5.html","path":"post/dfea82e5.html","title":"Hexo之搭建个人博客"}</script>

<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>Hexo之搭建个人博客 | 小四儿</title>
  

  <script src="/js/third-party/analytics/baidu-analytics.js" defer></script>
  <script async src="https://hm.baidu.com/hm.js?7a645cfcecaf8f711cd7518386adcc74"></script>







  
  <script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous" defer></script>
  <script src="https://cdn.jsdelivr.net/npm/@next-theme/pjax@0.6.0/pjax.min.js" integrity="sha256-vxLn1tSKWD4dqbMRyv940UYw4sXgMtYcK6reefzZrao=" crossorigin="anonymous" defer></script>
  <script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui@5.0.31/dist/fancybox/fancybox.umd.js" integrity="sha256-a+H7FYzJv6oU2hfsfDGM2Ohw/cR9v+hPfxHCLdmCrE8=" crossorigin="anonymous" defer></script>
  <script src="https://cdn.jsdelivr.net/npm/lozad@1.16.0/dist/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous" defer></script>
<script src="/js/utils.js" defer></script><script src="/js/motion.js" defer></script><script src="/js/sidebar.js" defer></script><script src="/js/next-boot.js" defer></script><script src="/js/pjax.js" defer></script>

  <script src="https://cdn.jsdelivr.net/npm/hexo-generator-searchdb@1.5.0/dist/search.js" integrity="sha256-xFC6PJ82SL9b3WkGjFavNiA9gm5z6UBxWPiu4CYjptg=" crossorigin="anonymous" defer></script>
<script src="/js/third-party/search/local-search.js" defer></script>

  <script class="next-config" data-name="pdf" type="application/json">{"object_url":{"url":"https://cdn.jsdelivr.net/npm/pdfobject@2.3.1/pdfobject.min.js","integrity":"sha256-jI72I8ZLVflVOisZIOaLvRew3tyvzeu6aZXFm7P7dEo="},"url":"/lib/pdf/web/viewer.html"}</script>
  <script src="/js/third-party/tags/pdf.js" defer></script>



  <script src="/js/third-party/fancybox.js" defer></script>



  
  <script data-pjax async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>




  <script src="https://cdn.jsdelivr.net/npm/quicklink@3.0.1/dist/quicklink.umd.js" integrity="sha256-44BednzIpUeQJcY8qtLyarFu0UCCTbgmWOvaoehiFQQ=" crossorigin="anonymous" defer></script>
  <script class="next-config" data-name="quicklink" type="application/json">{"enable":true,"home":true,"archive":true,"delay":true,"timeout":3000,"priority":true,"ignores":null,"url":"https://www.xiaosige.com/post/dfea82e5.html"}</script>
  <script src="/js/third-party/quicklink.js" defer></script>
<!-- https://www.layuicdn.com/layui/css/layui.css -->
<script src="https://www.layuicdn.com/layui/layui.js"></script>

<script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>


<script src="https://cdn.jsdelivr.net/npm/gsap@3.12.4/dist/gsap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/splitting@1.0.6/dist/splitting.min.js"></script>
<style type="text/css">
    .char{
      font-variation-settings: 'wght' var(--weight, 100);
      color: hsl(var(--hue), calc(var(--saturation) * 1%), 65%);
    }
</style>



<link rel="stylesheet" type="text/css" href="/css/shake.css" />


<link rel="stylesheet" type="text/css" href="/css/hover.css" />


<link rel="stylesheet" type="text/css" href="/zone/css/i_hover.css" />
<link rel="stylesheet" type="text/css" href="/css/injector/main.css" /><link rel="preload" as="style" href="/css/injector/light.css" /><link rel="preload" as="style" href="/css/injector/dark.css" />
  <noscript>
    <link rel="stylesheet" href="/css/noscript.css">
  </noscript>

<style>.github-emoji { position: relative; display: inline-block; width: 1.2em; min-height: 1.2em; overflow: hidden; vertical-align: top; color: transparent; }  .github-emoji > span { position: relative; z-index: 10; }  .github-emoji img, .github-emoji .fancybox { margin: 0 !important; padding: 0 !important; border: none !important; outline: none !important; text-decoration: none !important; user-select: none !important; cursor: auto !important; }  .github-emoji img { height: 1.2em !important; width: 1.2em !important; position: absolute !important; left: 50% !important; top: 50% !important; transform: translate(-50%, -50%) !important; user-select: none !important; cursor: auto !important; } .github-emoji-fallback { color: inherit; } .github-emoji-fallback img { opacity: 0 !important; }</style>
<link rel="alternate" href="/atom.xml" title="小四儿" type="application/atom+xml">
<link rel="alternate" href="/rss2.xml" title="小四儿" type="application/rss+xml"><!-- hexo-inject:begin --><!-- hexo-inject:end -->
</head>

<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
  <!-- hexo-inject:begin --><!-- hexo-inject:end --><div class="headband"></div>

  <main class="main">
    <div class="column">
      <header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container">
  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏" role="button">
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
        <span class="toggle-line"></span>
    </div>
  </div>

  <div class="site-meta">

    <a href="/" class="brand" rel="start">
      <i class="logo-line"></i>
      <p class="site-title">小四儿</p>
      <i class="logo-line"></i>
    </a>
      <p class="site-subtitle" itemprop="description">心之所愿，无所不至！</p>
  </div>

  <div class="site-nav-right">
    <div class="toggle popup-trigger" aria-label="搜索" role="button">
        <i class="fa fa-search fa-fw fa-lg"></i>
    </div>
  </div>
</div>



<nav class="site-nav">
  <ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">61</span></a></li><li class="menu-item menu-item-categories"><a href="/categories/" rel="section"><i class="fa fa-th fa-fw"></i>分类<span class="badge">25</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">149</span></a></li><li class="menu-item menu-item-welfare"><a href="/welfare" rel="section"><i class="fa fa-star fa-fw"></i>收藏</a></li><li class="menu-item menu-item-music"><a href="/music" rel="section"><i class="fa fa-music fa-fw"></i>音乐</a></li><li class="menu-item menu-item-photos"><a href="/photos" rel="section"><i class="fa fa-camera-retro fa-fw"></i>相册</a></li><li class="menu-item menu-item-links"><a href="/links" rel="section"><i class="fa fa-link fa-fw"></i>友链</a></li>
      <li class="menu-item menu-item-search">
        <a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
        </a>
      </li>
  </ul>
</nav>



  <div class="search-pop-overlay">
    <div class="popup search-popup">
      <div class="search-header">
        <span class="search-icon">
          <i class="fa fa-search"></i>
        </span>
        <div class="search-input-container">
          <input autocomplete="off" autocapitalize="off" maxlength="80"
                placeholder="搜索..." spellcheck="false"
                type="search" class="search-input">
        </div>
        <span class="popup-btn-close" role="button">
          <i class="fa fa-times-circle"></i>
        </span>
      </div>
      <div class="search-result-container">
        <div class="search-result-icon">
          <i class="fa fa-spinner fa-pulse fa-5x"></i>
        </div>
      </div>
    </div>
  </div>

</header>
        
  
  <aside class="sidebar">

    <div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
      <ul class="sidebar-nav">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <div class="sidebar-panel-container">
        <!--noindex-->
        <div class="post-toc-wrap sidebar-panel">
            <div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#%E4%BB%8B%E7%BB%8D"><span class="nav-number">1.</span> <span class="nav-text">介绍</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%89%8D%E6%9C%9F%E5%B7%A5%E4%BD%9C"><span class="nav-number">2.</span> <span class="nav-text">前期工作</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%BC%80%E5%A7%8B%E5%AE%89%E8%A3%85"><span class="nav-number">3.</span> <span class="nav-text">开始安装</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%89%E8%A3%85"><span class="nav-number">3.1.</span> <span class="nav-text">安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%88%9D%E5%A7%8B%E5%8C%96"><span class="nav-number">3.2.</span> <span class="nav-text">初始化</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%89%E8%A3%85%E6%A0%B8%E5%BF%83%E7%BB%84%E4%BB%B6"><span class="nav-number">3.3.</span> <span class="nav-text">安装核心组件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%AE%89%E8%A3%85-NexT-%E4%B8%BB%E9%A2%98"><span class="nav-number">3.4.</span> <span class="nav-text">安装 NexT 主题</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%9C%AC%E5%9C%B0%E8%B0%83%E8%AF%95"><span class="nav-number">3.5.</span> <span class="nav-text">本地调试</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%85%8D%E7%BD%AE-git"><span class="nav-number">3.6.</span> <span class="nav-text">配置 git</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%83%A8%E7%BD%B2"><span class="nav-number">3.7.</span> <span class="nav-text">部署</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Next-%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4"><span class="nav-number">3.8.</span> <span class="nav-text">Next 常用命令</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%A4%87%E4%BB%BD"><span class="nav-number">4.</span> <span class="nav-text">备份</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E6%81%A2%E5%A4%8D"><span class="nav-number">5.</span> <span class="nav-text">恢复</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#%E5%85%B6%E4%BB%96"><span class="nav-number">6.</span> <span class="nav-text">其他</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%BD%91%E7%AB%99%E5%9B%BE%E6%A0%87"><span class="nav-number">6.1.</span> <span class="nav-text">网站图标</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%B8%80%E9%94%AE%E9%83%A8%E7%BD%B2%E6%8F%92%E4%BB%B6"><span class="nav-number">6.2.</span> <span class="nav-text">一键部署插件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#back2top"><span class="nav-number">6.3.</span> <span class="nav-text">back2top</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%87%8F%E5%B0%91%E5%87%BA%E7%AB%99%E9%93%BE%E6%8E%A5"><span class="nav-number">6.4.</span> <span class="nav-text">减少出站链接</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#hexo-%E6%9C%AC%E5%9C%B0%E6%90%9C%E7%B4%A2"><span class="nav-number">6.5.</span> <span class="nav-text">hexo 本地搜索</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Rss-%E8%AE%A2%E9%98%85"><span class="nav-number">6.6.</span> <span class="nav-text">Rss 订阅</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%A2%9E%E5%8A%A0%E9%98%85%E8%AF%BB%E6%97%B6%E9%97%B4%E5%92%8C%E5%AD%97%E6%95%B0%E7%BB%9F%E8%AE%A1"><span class="nav-number">6.7.</span> <span class="nav-text">增加阅读时间和字数统计</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%B0%B8%E4%B9%85%E9%93%BE%E6%8E%A5%E6%8F%92%E4%BB%B6"><span class="nav-number">6.8.</span> <span class="nav-text">永久链接插件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%99%BE%E5%BA%A6%E4%B8%BB%E5%8A%A8%E6%8E%A8%E9%80%81"><span class="nav-number">6.9.</span> <span class="nav-text">百度主动推送</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E7%AB%99%E7%82%B9%E5%9C%B0%E5%9B%BE"><span class="nav-number">6.10.</span> <span class="nav-text">站点地图</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%96%87%E7%AB%A0%E7%BD%AE%E9%A1%B6%E6%8F%92%E4%BB%B6"><span class="nav-number">6.11.</span> <span class="nav-text">文章置顶插件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E9%9D%99%E6%80%81%E8%B5%84%E6%BA%90%E5%8E%8B%E7%BC%A9%E6%8F%92%E4%BB%B6"><span class="nav-number">6.12.</span> <span class="nav-text">静态资源压缩插件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%8E%A8%E8%8D%90%E6%96%87%E7%AB%A0%E6%8F%92%E4%BB%B6"><span class="nav-number">6.13.</span> <span class="nav-text">推荐文章插件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#emoji-%E8%A1%A8%E6%83%85%E6%94%AF%E6%8C%81"><span class="nav-number">6.14.</span> <span class="nav-text">emoji 表情支持</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E5%8A%A0%E5%AF%86%E6%8F%92%E4%BB%B6"><span class="nav-number">6.15.</span> <span class="nav-text">加密插件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#%E4%BE%A7%E6%A0%8F%E5%A4%B4%E5%83%8F%E5%8A%A8%E7%94%BB"><span class="nav-number">6.16.</span> <span class="nav-text">侧栏头像动画</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#languages-yml"><span class="nav-number">6.17.</span> <span class="nav-text">languages.yml</span></a></li></ol></li></ol></div>
        </div>
        <!--/noindex-->

        <div class="site-overview-wrap sidebar-panel">
          <div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image" alt="leeze"
      src="https://static.xiaosige.com/img/avatar/avatar.jpg">
  <p class="site-author-name" itemprop="name">leeze</p>
  <div class="site-description" itemprop="description">因上努力，果上随缘！</div>
</div>
<div class="site-state-wrap animated">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
        <a href="/archives/">
          <span class="site-state-item-count">149</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
          <a href="/categories/">
        <span class="site-state-item-count">25</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
          <a href="/tags/">
        <span class="site-state-item-count">61</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author animated">
      <span class="links-of-author-item">
        <a href="https://github.com/leeze2012" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;leeze2012" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://www.teambition.com/" title="Teambition → https:&#x2F;&#x2F;www.teambition.com" rel="noopener me" target="_blank"><i class="fab fa-mixcloud fa-fw"></i>Teambition</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://gitee.com/leeze" title="Gitee → https:&#x2F;&#x2F;gitee.com&#x2F;leeze" rel="noopener me" target="_blank"><i class="fab fa-gg fa-fw"></i>Gitee</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://www.jianshu.com/u/e4c5daf92fa6" title="简书 → https:&#x2F;&#x2F;www.jianshu.com&#x2F;u&#x2F;e4c5daf92fa6" rel="noopener me" target="_blank"><i class="fab fa-telegram fa-fw"></i>简书</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://codeup.aliyun.com/" title="Codeup → https:&#x2F;&#x2F;codeup.aliyun.com" rel="noopener me" target="_blank"><i class="fab fa-envira fa-fw"></i>Codeup</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://blog.csdn.net/lileeze" title="CSDN → https:&#x2F;&#x2F;blog.csdn.net&#x2F;lileeze" rel="noopener me" target="_blank"><i class="fa fa-crosshairs fa-fw"></i>CSDN</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://dev.tencent.com/u/leeze" title="腾讯云 → https:&#x2F;&#x2F;dev.tencent.com&#x2F;u&#x2F;leeze" rel="noopener me" target="_blank"><i class="fab fa-jsfiddle fa-fw"></i>腾讯云</a>
      </span>
      <span class="links-of-author-item">
        <a href="https://www.upyun.com/" title="又拍云 → https:&#x2F;&#x2F;www.upyun.com" rel="noopener me" target="_blank"><i class="fab fa-jsfiddle fa-fw"></i>又拍云</a>
      </span>
  </div>

<div class="site-overview-item animated" style="height:140px;">
    <div class="wrap">
        <div class="cup">
            <div class="cup__mouse"></div>
            <div class="cup__eyes"></div>
            <div class="cup__label">多喝水</div>
        </div>
        <div class="cup-shadow"></div>
    </div>
</div>

<style>

.wrap {
  width: 210px;
  height: 90px;
  -webkit-transform: translate(-50%, 50%);
          transform: translate(-50%, 50%);
  position: relative;
  left: 40%;
  /*top: 20%;*/
}

.cup {
  width: 140px;
  height: 100px;
  background: #FFF;
  box-shadow: inset 0px -10px 0 0 #EDDFE6;
  border-radius: 5px 5px 50px 50px;
  -webkit-transform-origin: bottom center;
          transform-origin: bottom center;
  -webkit-animation: .6s linear 0s infinite alternate cup;
          animation: .6s linear 0s infinite alternate cup;
  border: 3px solid #000;
  position: absolute;
  bottom: 0;
  left: 40px;
  z-index: 2;
}
.cup::before {
  content: '';
  width: 140px;
  background: #91ECED;
  height: 40px;
  border-radius: 100%;
  border: 3px solid #000;
  box-shadow: inset 0 20px 0 0 #fff;
  -webkit-animation: .6s linear 0s infinite alternate water;
          animation: .6s linear 0s infinite alternate water;
  position: absolute;
  top: -20px;
  left: -3px;
}
.cup::after {
  content: '';
  width: 22px;
  height: 26px;
  background: transparent;
  border-radius: 30% 100% 100% 30%;
  border: 3px solid #000;
  border-left: none;
  box-shadow: 4px 0 0 9px #fff, 6px 0 0 10px #000;
  position: absolute;
  bottom: 35px;
  right: -20px;
}
.cup__mouse {
  top: 45px;
  left: 45px;
  position: absolute;
  height: 30px;
  width: 50px;
  border: 3px solid #000;
  border-radius: 50%;
  -webkit-clip-path: polygon(50% 10%, 91% 100%, 5% 100%);
          clip-path: polygon(50% 10%, 91% 100%, 5% 100%);
}
.cup__eyes {
  width: 15px;
  height: 15px;
  background: #000;
  border-radius: 50%;
  box-shadow: 58px 0 0 0 #000;
  position: absolute;
  top: 55px;
  left: 35px;
}
.cup__label {
  width: 48px;
  height: 35px;
  box-sizing: content-box;
  /*padding-top: 10px;*/
  background: #ff7600;
  border: 2px solid #000;
  border-bottom: none;
  -webkit-transform-origin: top center;
          transform-origin: top center;
  -webkit-animation: .6s linear 0s infinite alternate label;
          animation: .6s linear 0s infinite alternate label;
  position: absolute;
  top: 40px;
  left: 45px;
  color: #fff
}
.cup__label::before {
  content: '';
  width: 3px;
  height: 15px;
  background: #000;
  -webkit-animation: .6s linear 0s infinite alternate label-line;
          animation: .6s linear 0s infinite alternate label-line;
  position: absolute;
  left: 25px;
  top: -16px;
}
.cup__label::after {
  content: '';
  position: absolute;
  left: -1px;
  bottom: 0;
  width: 0;
  height: 0;
  -webkit-filter: drop-shadow(0 -2px 0 black);
          filter: drop-shadow(0 -2px 0 black);
  border-bottom: 7px solid #fff;
  border-left: 26px solid transparent;
  border-right: 26px solid transparent;
}

.cup-shadow {
  width: 135px;
  height: 90px;
  background: #7CE589;
  border-radius: 40% 40% 100% 100%;
  -webkit-transform-origin: bottom center;
          transform-origin: bottom center;
  -webkit-animation: .6s linear 0s infinite alternate shadow;
          animation: .6s linear 0s infinite alternate shadow;
  position: absolute;
  bottom: -16px;
  left: 55px;
  z-index: 1;
}
.cup-shadow::after {
  content: '';
  width: 20px;
  height: 25px;
  background: transparent;
  border-radius: 30% 100% 100% 30%;
  border-left: none;
  box-shadow: 5px 0 0 5px #7CE589;
  position: absolute;
  bottom: 35px;
  right: -10px;
}

@-webkit-keyframes cup {
  0% {
    -webkit-transform: rotate(10deg);
            transform: rotate(10deg);
    box-shadow: inset -10px -10px 0 0 #EDDFE6;
  }
  100% {
    -webkit-transform: rotate(-10deg);
            transform: rotate(-10deg);
    box-shadow: inset 10px -10px 0 0 #EDDFE6;
  }
}

@keyframes cup {
  0% {
    -webkit-transform: rotate(10deg);
            transform: rotate(10deg);
    box-shadow: inset -10px -10px 0 0 #EDDFE6;
  }
  100% {
    -webkit-transform: rotate(-10deg);
            transform: rotate(-10deg);
    box-shadow: inset 10px -10px 0 0 #EDDFE6;
  }
}
@-webkit-keyframes water {
  0% {
    box-shadow: inset 30px 20px 0 0 #fff;
  }
  100% {
    box-shadow: inset -30px 20px 0 0 #fff;
  }
}
@keyframes water {
  0% {
    box-shadow: inset 30px 20px 0 0 #fff;
  }
  100% {
    box-shadow: inset -30px 20px 0 0 #fff;
  }
}
@-webkit-keyframes label {
  0% {
    -webkit-transform: rotate(40deg);
            transform: rotate(40deg);
  }
  100% {
    -webkit-transform: rotate(-40deg);
            transform: rotate(-40deg);
  }
}
@keyframes label {
  0% {
    -webkit-transform: rotate(40deg);
            transform: rotate(40deg);
  }
  100% {
    -webkit-transform: rotate(-40deg);
            transform: rotate(-40deg);
  }
}
@-webkit-keyframes label-line {
  0% {
    height: 15px;
    top: -16px;
  }
  25% {
    height: 22px;
    top: -22px;
  }
  50% {
    height: 15px;
    top: -16px;
  }
  100% {
    height: 22px;
    top: -22px;
  }
}
@keyframes label-line {
  0% {
    height: 15px;
    top: -16px;
  }
  25% {
    height: 22px;
    top: -22px;
  }
  50% {
    height: 15px;
    top: -16px;
  }
  100% {
    height: 22px;
    top: -22px;
  }
}
@-webkit-keyframes shadow {
  0% {
    -webkit-transform: skewX(-10deg);
            transform: skewX(-10deg);
  }
  100% {
    -webkit-transform: skewX(20deg);
            transform: skewX(20deg);
  }
}
@keyframes shadow {
  0% {
    -webkit-transform: skewX(-10deg);
            transform: skewX(-10deg);
  }
  100% {
    -webkit-transform: skewX(20deg);
            transform: skewX(20deg);
  }
}

.sidebar-panel{
    min-height: calc(var(--sidebar-wrapper-height) * 0.75);
}
.sidebar-toc-active .post-toc-wrap,
.sidebar-overview-active .site-overview-wrap {
  display: block;
}
</style>




<script src="/zone/js/canvasTime.js" async></script>
<div style="display:none;">
  <canvas id="canvas" style="width:60%;">当前浏览器不支持canvas，请更换浏览器后再试</canvas>
</div>
<style>
// 粒子时钟样式
.site-overview {
  text-align: center;
}

canvas#canvas {
  margin-top: 70px;
}
</style>


<div class="site-overview-item animated">
    <div style="">
        <iframe id="sjFrame" loading="lazy" src="/zone/tool/sj/index.html" border="0" width="100%" height="100" frameborder="no"> </iframe>
    </div>
</div>

        </div>
      </div>
    </div>

    
        <div class="pjax">
        </div>
  </aside>


    </div>

    <div class="main-inner post posts-expand">


  


<div class="post-block">
  
  

  <article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://www.xiaosige.com/post/dfea82e5.html">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="https://static.xiaosige.com/img/avatar/avatar.jpg">
      <meta itemprop="name" content="leeze">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="小四儿">
      <meta itemprop="description" content="因上努力，果上随缘！">
    </span>

    <span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
      <meta itemprop="name" content="Hexo之搭建个人博客 | 小四儿">
      <meta itemprop="description" content="">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          Hexo之搭建个人博客
        </h1>

        <div class="post-meta-container">
          <div class="post-meta">
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar"></i>
      </span>
      <span class="post-meta-item-text">发表于</span>

      <time title="创建时间：2019-08-26 12:23:00" itemprop="dateCreated datePublished" datetime="2019-08-26T12:23:00+08:00">2019-08-26</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-calendar-check"></i>
      </span>
      <span class="post-meta-item-text">更新于</span>
      <time title="修改时间：2020-10-12 17:24:29" itemprop="dateModified" datetime="2020-10-12T17:24:29+08:00">2020-10-12</time>
    </span>
    <span class="post-meta-item">
      <span class="post-meta-item-icon">
        <i class="far fa-folder"></i>
      </span>
      <span class="post-meta-item-text">分类于</span>
        <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
          <a href="/categories/hexo%E5%BB%BA%E7%AB%99/" itemprop="url" rel="index"><span itemprop="name">hexo建站</span></a>
        </span>
    </span>

  
    <span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="post-meta-item-text">阅读次数：</span>
      <span id="busuanzi_value_page_pv"></span>
    </span>



    <span class="post-meta-break"></span>
    <span class="post-meta-item" title="本文字数">
      <span class="post-meta-item-icon">
        <i class="far fa-file-word"></i>
      </span>
      <span class="post-meta-item-text">本文字数：</span>
      <span>15k</span>
    </span>
    <span class="post-meta-item" title="阅读时长">
      <span class="post-meta-item-icon">
        <i class="far fa-clock"></i>
      </span>
      <span class="post-meta-item-text">阅读时长 &asymp;</span>
      <span>14 分钟</span>
    </span>
</div>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody"><h2 id="介绍"><a href="#介绍" class="headerlink" title="介绍"></a>介绍</h2><p>    Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown（或其他渲染引擎）解析文章，在几秒内，即可利用靓丽的主题生成静态网页。hexo 博客在 Linux 系统中搭建是非常简单的，在 WIN 系统中比较复杂，我们接触的手机📱永远要比电脑的时间要多那么我们可以在安卓手机上使用 termux 来搭建，这样随时随地都可以写做和发表文章。</p>
  <span id="more"></span> 

<h2 id="前期工作"><a href="#前期工作" class="headerlink" title="前期工作"></a>前期工作</h2><div class="note success no-icon"><ol>
<li> 注册 <font color="LightCoral" size="4">github</font> 账号 </li>
<li> 添加 <font color="LightCoral" size="4">username.github.io</font> 仓库 </li>
<li> 搭建 <font color="LightCoral" size="4">git</font> 环境 </li>
<li> 配置 <font color="LightCoral" size="4">ssh</font> </li>
<li> 连接 <font color="LightCoral" size="4">github</font> </li>
<li> 安装 <font color="LightCoral" size="4">Node.js</font> </li>
<li> 搭建 <font color="LightCoral" size="4">Hexo</font> 环境 </li>
</ol>
</div>



<h2 id="开始安装"><a href="#开始安装" class="headerlink" title="开始安装"></a>开始安装</h2><h3 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h3><ol>
<li> <mark class="label danger">Node</mark> 环境安装：</li>

<p>   参考：<a href="/post/c0a81ac4.html" title="Mac正确的安装和使用nvm">Mac正确的安装和使用nvm</a></p>
<li> <mark class="label danger">Hexo</mark> 环境安装：</li>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash">$ <span class="token function">npm</span> <span class="token function">install</span> <span class="token parameter variable">-g</span> hexo-cli<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
</ol>

<h3 id="初始化"><a href="#初始化" class="headerlink" title="初始化"></a>初始化</h3><p>   安装完成之后，新建一个文件夹(例如: <code>blog</code>)，执行以下命令进行初始化：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash">$ <span class="token builtin class-name">cd</span> blog
$ hexo init<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre>

<h3 id="安装核心组件"><a href="#安装核心组件" class="headerlink" title="安装核心组件"></a>安装核心组件</h3><p>   安装 npm 核心组件支持</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token builtin class-name">cd</span> blog
<span class="token function">npm</span> <span class="token function">install</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre>

<p>   新建完成后，<code>cd blog</code>，查看文件夹目录<br> </p><div class="note primary no-icon"><p>_config.yml 文件是网站的配置文件，可以在其中配置网站的大部分参数。<br>package.json 文件是应用程序的信息。<br>source 是资源文件夹，是用来存放 xxxu 用户资源的地方。<br>themes 是主题文件夹，Hexo 会根据主题来生成不同的静态页面。<br>scaffolds 是模板件夹，当新建文章的时候，Hexo 会根据模板来建立文件。
 </p>
</div><p></p>
<h3 id="安装-NexT-主题"><a href="#安装-NexT-主题" class="headerlink" title="安装 NexT 主题"></a>安装 NexT 主题</h3><ol>

<li>下载主题：</li>

<p>   <a target="_blank" rel="noopener" href="https://hexo.io/">Hexo</a> 的主题非常丰富可以去<a target="_blank" rel="noopener" href="https://hexo.io/themes/">官方主题</a>下载；下面有演示我使用的主题 <a target="_blank" rel="noopener" href="https://github.com/theme-next/hexo-theme-next">next</a></p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token builtin class-name">cd</span> blog
<span class="token function">git</span> clone https://github.com/theme-next/hexo-theme-next themes/next<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre>
<li>修改主配置文件：</li>


<p>   在<code>站点</code>配置文件<code>_config.yml</code> 开启 next 主题，修改<code>theme</code>属性，注意 <code>theme: </code>后要加<code>空格</code>，具体的站点和主题信息配置请自行去 <a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/">hexo</a> 和 <a target="_blank" rel="noopener" href="http://theme-next.iissnan.com/">next 主题</a>文档查看</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token builtin class-name">cd</span> blog
<span class="token function">vi</span> _config.yml

theme: next <span class="token comment"># 找到 theme</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span></span></code></pre>

<li>修改主题配置文件：</li>

<p>   在<code>blog</code>文件夹下，新建<code>_config.next.yml</code>，存放主题修改内容。</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token builtin class-name">cd</span> blog
<span class="token function">touch</span> _config.next.yml  <span class="token comment"># themes/next/_config.yml 中需要修改的，放在这里。</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre>

</ol>

<h3 id="本地调试"><a href="#本地调试" class="headerlink" title="本地调试"></a>本地调试</h3><pre class="line-numbers language-bash" data-language="bash"><code class="language-bash">hexo g <span class="token comment"># 生成静态页面，生成的内容在public文件夹下</span>
hexo s <span class="token comment"># 启动本地服务，进行文章预览调试。hexo s --debug 命令可以用来调试</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre>


<h3 id="配置-git"><a href="#配置-git" class="headerlink" title="配置 git"></a>配置 git</h3><p>   配置 ssh 密钥及 github 或者 gitee 部署</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token punctuation">..</span><span class="token punctuation">..</span><span class="token punctuation">..</span>
ssh-key <span class="token punctuation">..</span><span class="token punctuation">..</span>
省略。。。
$ <span class="token function">git</span> config <span class="token parameter variable">--global</span> user.name <span class="token string">"your name"</span>
$ <span class="token function">git</span> config <span class="token parameter variable">--global</span> user.email <span class="token string">"email@email.com"</span>
省略。。。
<span class="token punctuation">..</span><span class="token punctuation">..</span><span class="token punctuation">..</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>


<h3 id="部署"><a href="#部署" class="headerlink" title="部署"></a>部署</h3><ol>
<li>安装 <font color="LightCoral" size="3">hexo-deployer-git</font> 插件</li>

<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash">$ <span class="token builtin class-name">cd</span> blog
$ <span class="token function">npm</span> <span class="token function">install</span> hexo-deployer-git <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre>

<div style="height: 10px;"></div>

<li>打开 Hexo 主文件夹下的<font color="LightCoral" size="3">_config.yml</font>，设置其中的 <font color="hotpink" size="3">deploy</font> 参数</li>

<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token builtin class-name">cd</span> blog
<span class="token function">vi</span> _config.yml

deploy:
    type: <span class="token function">git</span> 
    repo: git@github.com:leeze2012/leeze2012.github.io.git
    branch: master<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<div style="height: 10px;"></div>

<li>安装完成插件之后，<font color="LightCoral" size="3">blog</font> 目录下使用以下命令部署</li>

<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash">$ hexo d <span class="token parameter variable">-g</span> <span class="token comment"># 在部署前先生成</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>

</ol>


<h3 id="Next-常用命令"><a href="#Next-常用命令" class="headerlink" title="Next 常用命令"></a>Next 常用命令</h3><div style="height: 10px;"></div>

<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash">$ hexo clean     <span class="token comment"># 清理之前生成的内容，即public文件</span>
$ hexo g         <span class="token comment"># 生成静态文件</span>
$ hexo d         <span class="token comment"># 部署</span>
$ hexo s         <span class="token comment"># 启动本地服务，可以通过http://localhost:4000查看</span>
$ hexo s <span class="token parameter variable">--debug</span> <span class="token comment"># 使用debug模式启动服务</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<h2 id="备份"><a href="#备份" class="headerlink" title="备份"></a>备份</h2><ol>

<li>在 github 新建一个叫 blog 的仓库。</li>

<li>在本地博客文件夹创建 git 版本库，如果没有安装 git 必须先安装 git。</li>

<li>进入需要备份 blog 目录。</li>

<li>创建版本库。</li>

<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token builtin class-name">cd</span> blog
<span class="token function">git</span> init<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre>

<div style="height: 10px;"></div>

<p>这个时候 blog 的版本库已经创建好了。<br>验证是否成功，如果有一个 <font color="hotpink" size="4"> .git </font> 的隐藏文件就说明创建成功。<br>查看隐藏文件</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">ls</span> <span class="token parameter variable">-a</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>

<div style="height: 10px;"></div>

<li> 连接上面 github 创建的仓库</li>

<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">git</span> remote <span class="token function">add</span> origin github.com:leeze2012/blog.git<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>

<div style="height: 10px;"></div>

<li> 添加备份文件 </li>

<p><code>source/</code> <code>scripts/</code> <code>themes/</code> <code>_config.yml</code> <code>_config.next.yml</code> <code>scaffolds/</code> <code>package.json</code> <code>.gitignore</code> 这些文件需要备份</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">git</span> <span class="token function">add</span> source/ scripts/ themes/ _config.yml _config.next.yml scaffolds/ package.json .gitignore<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>

<div style="height: 10px;"></div>

<p>修改.gitignore文件（如果没有请手动创建一个），在里面加入<code>*.log</code> 和 <code>public/</code> 以及<code>.deploy*/</code></p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">vi</span> .gitignore

   .DS_Store
   themes/
   db.json
   *.log
   node_modules/
   public/
   .deploy*/
   .idea/

<span class="token function">git</span> <span class="token function">add</span> <span class="token builtin class-name">.</span>
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<div style="height: 10px;"></div>

<li> 注释备份内容，明确的注释可以回退版本</li>

<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">git</span> commit <span class="token parameter variable">-m</span> <span class="token string">"博客备份"</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>

<div style="height: 10px;"></div>

<li> 第一次强制上传文件到 github 仓库</li>

<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">git</span> push <span class="token parameter variable">-u</span> origin master<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>

<div style="height: 10px;"></div>
这样博客就备份成功了，之后备份直接前面 <mark class="label danger">6</mark> 、<mark class="label danger">7</mark> 步，第 <font color="green" size="4">8</font> 部直接使用下面命令就可以了

<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">git</span> push origin master<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>

<div style="height: 10px;"></div>

<li> 安装<font color="LightCoral" size="4">shelljs</font>模块,实现自动备份。</li>

<div style="height: 10px;"></div>

<p>  要实现这个自动备份功能，需要依赖NodeJs的一个<code>shelljs</code>模块,该模块重新包装了<code>child_process</code>,调用系统命令更加的方便。（其实就是因为博主懒( ╯▽╰)）该模块需要安装后使用。</p>
<p>在命令中键入以下命令，完成<code>shelljs</code>模块的安装：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> shelljs <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>

<div style="height: 10px;"></div>
编写自动备份脚本

<p>待到模块安装完成，在<code>Hexo根目录</code>的<code>scripts</code>文件夹下新建一个<code>js文件</code>，文件名<code>随意取</code>。</p>
<p>如果没有<code>scripts</code>目录，请新建一个。</p>
<p>然后在脚本中，写入以下内容：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash">require<span class="token punctuation">(</span><span class="token string">'shelljs/global'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

try <span class="token punctuation">{</span>
	hexo.on<span class="token punctuation">(</span><span class="token string">'deployAfter'</span>, <span class="token function-name function">function</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>//当deploy完成后执行备份
		run<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
	<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span> catch <span class="token punctuation">(</span>e<span class="token punctuation">)</span> <span class="token punctuation">{</span>
	console.log<span class="token punctuation">(</span><span class="token string">"产生了一个错误&lt;(￣3￣)&gt; !，错误详情为："</span> + e.toString<span class="token punctuation">(</span><span class="token punctuation">))</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>

<span class="token keyword">function</span> <span class="token function-name function">run</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
	<span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token operator">!</span>which<span class="token punctuation">(</span><span class="token string">'git'</span><span class="token punctuation">))</span> <span class="token punctuation">{</span>
		echo<span class="token punctuation">(</span><span class="token string">'Sorry, this script requires git'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		exit<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
	<span class="token punctuation">}</span> <span class="token keyword">else</span> <span class="token punctuation">{</span>
		echo<span class="token punctuation">(</span><span class="token string">"======================Auto Backup Begin==========================="</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		cd<span class="token punctuation">(</span><span class="token string">'~/git/blog'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>    //此处修改为Hexo根目录路径
		<span class="token keyword">if</span> <span class="token punctuation">(</span>exec<span class="token punctuation">(</span><span class="token string">'git add --all'</span><span class="token punctuation">)</span>.code <span class="token operator">!=</span><span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
			echo<span class="token punctuation">(</span><span class="token string">'Error: Git add failed'</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
			exit<span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

		<span class="token punctuation">}</span>
		<span class="token keyword">if</span> <span class="token punctuation">(</span>exec<span class="token punctuation">(</span><span class="token string">'git commit -am "Form auto backup script\'</span>s commit<span class="token string">"').code !== 0) {
			echo('Error: Git commit failed');
			exit(1);

		}
		if (exec('git push origin master').code !== 0) {
			echo('Error: Git push failed');
			exit(1);

		}
		echo("</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span>Auto Backup <span class="token assign-left variable">Complete</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span>"<span class="token punctuation">)</span>
	<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<div style="height: 10px;"></div>

<ul>
<li><p>其中，需要修改第<code>17</code>行的<code>~/git/blog</code>路径为Hexo的根目录路径。（脚本中的路径为博主的Hexo路径）</p>
</li>
<li><p>如果你的Git远程仓库名称不为<code>origin</code>的话，还需要修改第<code>28</code>行执行的push命令，修改成自己的远程仓库名和相应的分支名。</p>
</li>
<li><p>保存脚本并退出，然后执行hexo deploy命令，将会得到类似以下结果:</p>
</li>
</ul>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash">INFO  Deploying: <span class="token function">git</span>
INFO  Clearing .deploy_git folder<span class="token punctuation">..</span>.
INFO  Copying files from public folder<span class="token punctuation">..</span>.
INFO  Copying files from extend dirs<span class="token punctuation">..</span>.
<span class="token punctuation">[</span>master 2fd18b4<span class="token punctuation">]</span> Site updated: <span class="token number">2020</span>-03-02 <span class="token number">13</span>:46:34
 <span class="token number">4</span> files changed, <span class="token number">42</span> insertions<span class="token punctuation">(</span>+<span class="token punctuation">)</span>, <span class="token number">4</span> deletions<span class="token punctuation">(</span>-<span class="token punctuation">)</span>
枚举对象: <span class="token number">19</span>, 完成.
对象计数中: <span class="token number">100</span>% <span class="token punctuation">(</span><span class="token number">19</span>/19<span class="token punctuation">)</span>, 完成.
使用 <span class="token number">8</span> 个线程进行压缩
压缩对象中: <span class="token number">100</span>% <span class="token punctuation">(</span><span class="token number">8</span>/8<span class="token punctuation">)</span>, 完成.
写入对象中: <span class="token number">100</span>% <span class="token punctuation">(</span><span class="token number">10</span>/10<span class="token punctuation">)</span>, <span class="token number">4.25</span> KiB <span class="token operator">|</span> <span class="token number">1.06</span> MiB/s, 完成.
总共 <span class="token number">10</span> （差异 <span class="token number">7</span>），复用 <span class="token number">0</span> （差异 <span class="token number">0</span>）
remote: Resolving deltas: <span class="token number">100</span>% <span class="token punctuation">(</span><span class="token number">7</span>/7<span class="token punctuation">)</span>, completed with <span class="token number">7</span> <span class="token builtin class-name">local</span> objects.
To github.com:leeze2012/leeze2012.github.io.git
   42f1ef1<span class="token punctuation">..</span>2fd18b4  HEAD -<span class="token operator">&gt;</span> master
分支 <span class="token string">'master'</span> 设置为跟踪来自 <span class="token string">'git@github.com:leeze2012/leeze2012.github.io.git'</span> 的远程分支 <span class="token string">'master'</span>。
INFO  Deploy done: <span class="token function">git</span>
INFO  Deploying: baidu_url_submitter
INFO  Submitting urls
https://blog.xiaosige.com/post/c1dab809.html
https://blog.xiaosige.com/post/73879c7f.html
<span class="token punctuation">{</span><span class="token string">"remain"</span>:99984,<span class="token string">"success"</span>:2<span class="token punctuation">}</span>
INFO  Deploy done: baidu_url_submitter
<span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span>Auto Backup <span class="token assign-left variable">Begin</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">=</span>
<span class="token punctuation">[</span>master af0e0a8<span class="token punctuation">]</span> Form auto backup script's commit
 <span class="token number">2</span> files changed, <span class="token number">75</span> insertions<span class="token punctuation">(</span>+<span class="token punctuation">)</span>
 create mode <span class="token number">100644</span> scripts/.bc.js.swo
To github.com:leeze2012/blog.git
   49dd62c<span class="token punctuation">..</span>af0e0a8  master -<span class="token operator">&gt;</span> master
<span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span>Auto Backup <span class="token assign-left variable">Complete</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span class="token operator">==</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<div style="height: 10px;"></div>

<p>这样子，每次更新博文并<code>deploy</code>到服务器上之后，备份就自动启动并完成备份啦</p>
</ol>

<h2 id="恢复"><a href="#恢复" class="headerlink" title="恢复"></a>恢复</h2><ol>

<li> git clone 自己备份的博客源代码克隆备份的 bolg 源文件地址是你自己的地址这里不做演示</li>

<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">git</span> clone <span class="token operator">&lt;</span>版本库的网址<span class="token operator">&gt;</span> <span class="token operator">&lt;</span>本地目录名<span class="token operator">&gt;</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token builtin class-name">cd</span> bolg
hexo init
<span class="token punctuation">..</span>.
<span class="token function">npm</span> <span class="token function">install</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span></span></code></pre>

<div style="height: 10px;"></div>

<li> 安装相应插件：</li>

<p>   本人<code>package.json</code>，<a href="#pkJson">参考</a></p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-deployer-git <span class="token parameter variable">--save</span>
<span class="token function">npm</span> <span class="token function">install</span> hexo-generator-searchdb <span class="token parameter variable">--save</span>
<span class="token function">npm</span> <span class="token function">install</span> valine <span class="token parameter variable">--save</span>
<span class="token function">npm</span> <span class="token function">install</span> hexo-symbols-count-time <span class="token parameter variable">--save</span>
<span class="token function">npm</span> <span class="token function">install</span> hexo-baidu-url-submit <span class="token parameter variable">--save</span>
<span class="token function">npm</span> <span class="token function">install</span> hexo-abbrlink <span class="token parameter variable">--save</span>
<span class="token function">npm</span> <span class="token function">install</span> hexo-blog-encrypt <span class="token parameter variable">--save</span>

<span class="token function">npm</span> uninstall hexo-generator-index <span class="token parameter variable">--save</span>
<span class="token function">npm</span> <span class="token function">install</span> hexo-generator-index-pin-top <span class="token parameter variable">--save</span>

<span class="token function">npm</span> <span class="token function">install</span> hexo-asset-image <span class="token parameter variable">--save</span>  <span class="token punctuation">(</span>推荐这个<span class="token punctuation">)</span> 

<span class="token comment">## 以下参考选择</span>

<span class="token function">npm</span> <span class="token function">install</span> hexo-tag-aplayer <span class="token parameter variable">--save</span>
<span class="token function">npm</span> <span class="token function">install</span> hexo-tag-dplayer <span class="token parameter variable">--save</span>

<span class="token function">npm</span> <span class="token function">install</span> hexo-hide-posts <span class="token parameter variable">--save</span>
<span class="token comment">#二选一</span>
<span class="token function">npm</span> <span class="token function">install</span> hexo-spoiler <span class="token parameter variable">--save</span>

<span class="token comment">## 代码主题不用highlight，改用prismjs时，可以扩展prismjs的主题</span>
<span class="token comment">## npm i -S hexo-prism-plugin </span>
<span class="token comment">## 参考：https://theme-next.js.org/highlight/</span>
<span class="token function">npm</span> <span class="token function">install</span> prism-themes 

<span class="token comment"># 添加 RSS 订阅支持（可选的）atom/rss2</span>
<span class="token function">npm</span> <span class="token function">install</span> <span class="token parameter variable">--save</span> hexo-generator-feed

<span class="token comment"># 添加 emoji 表情支持（可选的）</span>
<span class="token function">npm</span> <span class="token function">install</span> hexo-filter-github-emojis <span class="token parameter variable">--save</span>
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<div style="height: 10px;"></div>

<p><strong><code>注：</code></strong> ，使用<code>hexo-asset-image</code>，参考：<a href="/post/172c7c2b.html" title="hexo之图片问题">hexo之图片问题</a></p>
<div class="note warning no-icon"><p><strong>在 npm 5 之前的版本</strong></p>
<p>   使用 <code>npm install</code> 默认选项安装包时，仅仅会把包下载到 <code>node_modules/</code> 中，并<code>不会</code>同时修改 <code>package.json</code>。而使用 <code>--save</code> 选项就可以在安装包的同时，<code>修改</code> <code>package.json</code> 文件。</p>
<p><strong>在 npm 5 之后的版本</strong></p>
<p>   <code>npm install</code> 安装包时，默认便<code>会修改</code> <code>package.json</code> 文件，所以 <code>--save</code> 选项已经<code>不再需要</code>了。</p>
</div>

<p><strong><em><font color="orangered" size="4">注：一些东西摘自网上，未亲自验证。</font></em></strong></p>
<li> package.json：</li>

<div id="pkJson"></div>

<pre class="line-numbers language-properties" data-language="properties"><code class="language-properties">{
<span class="token key attr-name">  "name"</span><span class="token punctuation">:</span> <span class="token value attr-value">"hexo-site",</span>
<span class="token key attr-name">  "version"</span><span class="token punctuation">:</span> <span class="token value attr-value">"0.0.0",</span>
<span class="token key attr-name">  "private"</span><span class="token punctuation">:</span> <span class="token value attr-value">true,</span>
<span class="token key attr-name">  "scripts"</span><span class="token punctuation">:</span> <span class="token value attr-value">{</span>
<span class="token key attr-name">    "build"</span><span class="token punctuation">:</span> <span class="token value attr-value">"hexo generate",</span>
<span class="token key attr-name">    "clean"</span><span class="token punctuation">:</span> <span class="token value attr-value">"hexo clean",</span>
<span class="token key attr-name">    "deploy"</span><span class="token punctuation">:</span> <span class="token value attr-value">"hexo deploy",</span>
<span class="token key attr-name">    "server"</span><span class="token punctuation">:</span> <span class="token value attr-value">"hexo server"</span>
  },
<span class="token key attr-name">  "hexo"</span><span class="token punctuation">:</span> <span class="token value attr-value">{</span>
<span class="token key attr-name">    "version"</span><span class="token punctuation">:</span> <span class="token value attr-value">"5.2.0"</span>
  },
<span class="token key attr-name">  "dependencies"</span><span class="token punctuation">:</span> <span class="token value attr-value">{</span>
<span class="token key attr-name">    "hexo"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^5.2.0",</span>
<span class="token key attr-name">    "hexo-abbrlink"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^2.2.1",</span>
<span class="token key attr-name">    "hexo-asset-image"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^1.0.0",</span>
<span class="token key attr-name">    "hexo-baidu-url-submit"</span><span class="token punctuation">:</span> <span class="token value attr-value">"0.0.6",</span>
<span class="token key attr-name">    "hexo-blog-encrypt"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^3.0.13",</span>
<span class="token key attr-name">    "hexo-cake-moon-menu"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^2.3.1",</span>
<span class="token key attr-name">    "hexo-deployer-git"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^2.1.0",</span>
<span class="token key attr-name">    "hexo-filter-github-emojis"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^2.1.0",</span>
<span class="token key attr-name">    "hexo-generator-archive"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^1.0.0",</span>
<span class="token key attr-name">    "hexo-generator-baidu-sitemap"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^0.1.9",</span>
<span class="token key attr-name">    "hexo-generator-category"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^1.0.0",</span>
<span class="token key attr-name">    "hexo-generator-feed"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^3.0.0",</span>
<span class="token key attr-name">    "hexo-generator-index-pin-top"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^0.2.2",</span>
<span class="token key attr-name">    "hexo-generator-searchdb"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^1.3.3",</span>
<span class="token key attr-name">    "hexo-generator-sitemap"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^2.1.0",</span>
<span class="token key attr-name">    "hexo-generator-tag"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^1.0.0",</span>
<span class="token key attr-name">    "hexo-hide-posts"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^0.1.1",</span>
<span class="token key attr-name">    "hexo-inject"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^1.0.0",</span>
<span class="token key attr-name">    "hexo-neat"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^1.0.9",</span>
<span class="token key attr-name">    "hexo-related-popular-posts"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^5.0.1",</span>
<span class="token key attr-name">    "hexo-renderer-ejs"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^1.0.0",</span>
<span class="token key attr-name">    "hexo-renderer-marked"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^3.3.0",</span>
<span class="token key attr-name">    "hexo-renderer-pug"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^1.0.0",</span>
<span class="token key attr-name">    "hexo-renderer-stylus"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^2.0.1",</span>
<span class="token key attr-name">    "hexo-server"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^2.0.0",</span>
<span class="token key attr-name">    "hexo-sliding-spoiler"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^1.2.1",</span>
<span class="token key attr-name">    "hexo-symbols-count-time"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^0.7.1",</span>
<span class="token key attr-name">    "hexo-tag-friends"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^0.3.4",</span>
<span class="token key attr-name">    "prismjs"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^1.21.0",</span>
<span class="token key attr-name">    "shelljs"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^0.8.4",</span>
<span class="token key attr-name">    "valine"</span><span class="token punctuation">:</span> <span class="token value attr-value">"^1.4.14"</span>
  }
}<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

</ol>

<h2 id="其他"><a href="#其他" class="headerlink" title="其他"></a>其他</h2><h3 id="网站图标"><a href="#网站图标" class="headerlink" title="网站图标"></a>网站图标</h3><p>  <a target="_blank" rel="noopener" href="https://realfavicongenerator.net/">网站图标生成网站</a></p>
<p>  只要把<code>png</code>图片放进去（尺寸不能太大）</p>
<p>  就可以生成一套图标（苹果手机桌面图标，网页图标，win磁贴图标等等）</p>
<img data-src="/post/dfea82e5/faviconbuild.png" class="" title="示例图">
<p>  下载之后放到<code>blog\source\my_images</code>文件夹中</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token key atrule">favicon</span><span class="token punctuation">:</span>
  <span class="token key atrule">small</span><span class="token punctuation">:</span> /my_images/favicon<span class="token punctuation">-</span>16x16.png
  <span class="token key atrule">medium</span><span class="token punctuation">:</span> /my_images/favicon<span class="token punctuation">-</span>32x32.png
  <span class="token key atrule">apple_touch_icon</span><span class="token punctuation">:</span> /my_images/apple<span class="token punctuation">-</span>touch<span class="token punctuation">-</span>icon.png
  <span class="token key atrule">safari_pinned_tab</span><span class="token punctuation">:</span> /my_images/safari<span class="token punctuation">-</span>pinned<span class="token punctuation">-</span>tab.svg
  <span class="token key atrule">android_manifest</span><span class="token punctuation">:</span> /my_images/site.webmanifest
  <span class="token key atrule">ms_browserconfig</span><span class="token punctuation">:</span> /my_images/browserconfig.xml<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<h3 id="一键部署插件"><a href="#一键部署插件" class="headerlink" title="一键部署插件"></a>一键部署插件</h3><p>  插件：<a target="_blank" rel="noopener" href="https://github.com/hexojs/hexo-deployer-git">hexo-deployer-git</a><br>  安装插件：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-deployer-git <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<p>  然后修改<code>站点配置文件</code> 中的配置：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token key atrule">deploy</span><span class="token punctuation">:</span>
  <span class="token punctuation">-</span> <span class="token key atrule">type</span><span class="token punctuation">:</span> git
    <span class="token key atrule">repository</span><span class="token punctuation">:</span> git@github.com<span class="token punctuation">:</span>constown/constown.github.io.git
    <span class="token key atrule">branch</span><span class="token punctuation">:</span> master<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span></span></code></pre>

<h3 id="back2top"><a href="#back2top" class="headerlink" title="back2top"></a>back2top</h3><p>  Hexo 修改 <code>back2top</code> 标签： <a target="_blank" rel="noopener" href="https://github.com/jiangtj-lab/hexo-cake-moon-menu">hexo-cake-moon-menu</a></p>
<p>  安装插件：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-cake-moon-menu <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>

<p>  然后在站点配置文件<code>_config.yml</code> 中添加以下代码：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token key atrule">moon_menu</span><span class="token punctuation">:</span>
  <span class="token key atrule">back2top</span><span class="token punctuation">:</span>
    <span class="token key atrule">enable</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
    <span class="token key atrule">icon</span><span class="token punctuation">:</span> fa fa<span class="token punctuation">-</span>chevron<span class="token punctuation">-</span>up
    <span class="token key atrule">func</span><span class="token punctuation">:</span> back2top
    <span class="token key atrule">order</span><span class="token punctuation">:</span> <span class="token number">-1</span>
  <span class="token key atrule">back2bottom</span><span class="token punctuation">:</span>
    <span class="token key atrule">enable</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
    <span class="token key atrule">icon</span><span class="token punctuation">:</span> fa fa<span class="token punctuation">-</span>chevron<span class="token punctuation">-</span>down
    <span class="token key atrule">func</span><span class="token punctuation">:</span> back2bottom
    <span class="token key atrule">order</span><span class="token punctuation">:</span> <span class="token number">-2</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<h3 id="减少出站链接"><a href="#减少出站链接" class="headerlink" title="减少出站链接"></a>减少出站链接</h3><p>  减少出站链接能够有效防止权重分散，hexo 有很方便的自动为出站链接添加 <code>nofollow</code> 标签的插件。</p>
<p>  首先安装 <code>hexo-filter-nofollow</code> 插件：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-filter-nofollow <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<p>  然后我们在站点的配置文件<code>_config.yml</code> 中添加配置，将 <code>nofollow</code> 设置为 <code>true</code>：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token comment"># 外部链接优化</span>
<span class="token key atrule">nofollow</span><span class="token punctuation">:</span>
  <span class="token key atrule">enable</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token key atrule">field</span><span class="token punctuation">:</span> site
  <span class="token key atrule">exclude</span><span class="token punctuation">:</span>
    <span class="token punctuation">-</span> <span class="token string">'exclude1.com'</span>
    <span class="token punctuation">-</span> <span class="token string">'exclude2.com'</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>  其中 <code>exclude</code>（例外的链接，比如友链）将不会被加上 <code>nofollow</code> 属性。 </p>
<h3 id="hexo-本地搜索"><a href="#hexo-本地搜索" class="headerlink" title="hexo 本地搜索"></a>hexo 本地搜索</h3><p>  NexT 主题已经实现这个功能，它用了 Hexo 的拓展包 hexo-generator-searchdb，预先生成了一个文本库 search.xml，然后传到了网站里面。在本地搜索的时候，NexT 直接用 javascript 调用了这个文件，从而实现了静态网站的本地搜索。</p>
<p>  安装插件:</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-generator-searchdb <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<p>  然后我们修改站点配置<code>_config.yml</code> 文件，添加如下内容：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token comment"># 本地搜索</span>
<span class="token key atrule">search</span><span class="token punctuation">:</span>
  <span class="token key atrule">path</span><span class="token punctuation">:</span> search.xml
  <span class="token key atrule">field</span><span class="token punctuation">:</span> post
  <span class="token key atrule">format</span><span class="token punctuation">:</span> html
  <span class="token key atrule">limit</span><span class="token punctuation">:</span> <span class="token number">10000</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<ul>
<li>path：索引文件的路径，相对于站点根目录</li>
<li>field：搜索范围，默认是 post，还可以选择 page、all，设置成 all 表示搜索所有页面</li>
<li>limit：限制搜索的条目数</li>
</ul>
<p>  然后修改<code>主题配置</code>文件<code>_config.yml</code>：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token comment"># Local Search</span>
<span class="token comment"># Dependencies: https://github.com/theme-next/hexo-generator-searchdb</span>
local_search:
  enable: <span class="token boolean">true</span>
  <span class="token comment"># If auto, trigger search by changing input.</span>
  <span class="token comment"># If manual, trigger search by pressing enter key or search button.</span>
  trigger: auto
  <span class="token comment"># Show top n results per article, show all results by setting to -1</span>
  top_n_per_article: <span class="token number">1</span>
  <span class="token comment"># Unescape html strings to the readable one.</span>
  unescape: <span class="token boolean">false</span>
  <span class="token comment"># Preload the search data when the page loads.</span>
  preload: <span class="token boolean">false</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<h3 id="Rss-订阅"><a href="#Rss-订阅" class="headerlink" title="Rss 订阅"></a>Rss 订阅</h3><p>  安装插件：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-generator-feed <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<p>  在站点配置文件<code>_config.yml</code> 中添加以下代码：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token key atrule">feed</span><span class="token punctuation">:</span>
  <span class="token key atrule">type</span><span class="token punctuation">:</span> atom
  <span class="token key atrule">path</span><span class="token punctuation">:</span> atom.xml
  <span class="token key atrule">limit</span><span class="token punctuation">:</span> <span class="token number">20</span>
  <span class="token key atrule">hub</span><span class="token punctuation">:</span>
  <span class="token key atrule">content</span><span class="token punctuation">:</span>
  <span class="token key atrule">content_limit</span><span class="token punctuation">:</span> <span class="token number">140</span>
  <span class="token key atrule">content_limit_delim</span><span class="token punctuation">:</span> <span class="token string">' '</span>
  <span class="token key atrule">order_by</span><span class="token punctuation">:</span> <span class="token punctuation">-</span>date
  <span class="token key atrule">icon</span><span class="token punctuation">:</span> icon.png
  <span class="token key atrule">autodiscovery</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  template<span class="token punctuation">:</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<h3 id="增加阅读时间和字数统计"><a href="#增加阅读时间和字数统计" class="headerlink" title="增加阅读时间和字数统计"></a>增加阅读时间和字数统计</h3><p>  首先安装 <code>hexo-symbols-count-time</code>:</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> i hexo-symbols-count-time <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<p>  如果之前安装了<code>hexo-wordcount</code>就要卸载掉npm uninstall hexo-wordcount，因为它只适用于老版本，网页也有教程是这个，<br>  修改站点配置文件<code>_config.yml</code>，没有就添加:</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token key atrule">symbols_count_time</span><span class="token punctuation">:</span> 
  <span class="token key atrule">symbols</span><span class="token punctuation">:</span> <span class="token boolean important">true</span> <span class="token comment">#文章内是否显示</span>
  <span class="token key atrule">time</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token key atrule">total_symbols</span><span class="token punctuation">:</span> <span class="token boolean important">true</span> <span class="token comment"># 网页底部是否显示</span>
  <span class="token key atrule">total_time</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token key atrule">exclude_codeblock</span><span class="token punctuation">:</span> <span class="token boolean important">false</span>
  <span class="token key atrule">awl</span><span class="token punctuation">:</span> <span class="token number">4</span>
  <span class="token key atrule">wpm</span><span class="token punctuation">:</span> <span class="token number">275</span>
  <span class="token key atrule">suffix</span><span class="token punctuation">:</span> <span class="token string">'mins.'</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>  其中awl（Average Word Length）的数值是设定多少字符统计为一个字(word)，中文博客需要设置为 2。wpm（Words Per Minute）是你的阅读速度，多少字（word）统计为阅读时长一分钟。以下是官方文档里的一些阅读速度参考数据：</p>
<ul>
<li>慢速：200</li>
<li>中速：275（默认）</li>
<li>快速：350</li>
</ul>
<p>  然后修改主题配置文件<code>next/_config.yml</code>，</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token key atrule">symbols_count_time</span><span class="token punctuation">:</span>
  <span class="token key atrule">separated_meta</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token key atrule">item_text_post</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token key atrule">item_text_total</span><span class="token punctuation">:</span> <span class="token boolean important">true</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span></span></code></pre>
<p>  最后需要<code>hexo clean</code>然后重新生成，否则可能会出现阅读时间NaN字样，参考官方</p>
<h3 id="永久链接插件"><a href="#永久链接插件" class="headerlink" title="永久链接插件"></a>永久链接插件</h3><p>  插件：<a target="_blank" rel="noopener" href="https://github.com/rozbo/hexo-abbrlink">hexo-abbrlink</a></p>
<p>  安装插件：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-abbrlink <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<p>  然后我们可以在<code>站点配置</code>文件中修改为：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token comment"># URL</span>
<span class="token key atrule">url</span><span class="token punctuation">:</span> https<span class="token punctuation">:</span>//blog.juanertu.com
<span class="token key atrule">root</span><span class="token punctuation">:</span> /
<span class="token key atrule">permalink</span><span class="token punctuation">:</span> archives/<span class="token punctuation">:</span>abbrlink.html
<span class="token key atrule">permalink_defaults</span><span class="token punctuation">:</span>
<span class="token key atrule">pretty_urls</span><span class="token punctuation">:</span>
  <span class="token key atrule">trailing_index</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token key atrule">trailing_html</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
<span class="token key atrule">abbrlink</span><span class="token punctuation">:</span>
  <span class="token key atrule">alg</span><span class="token punctuation">:</span> crc32 <span class="token comment"># 算法：crc16(default) and crc32</span>
  <span class="token key atrule">rep</span><span class="token punctuation">:</span> hex <span class="token comment"># 进制：dec(default) and hex</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h3 id="百度主动推送"><a href="#百度主动推送" class="headerlink" title="百度主动推送"></a>百度主动推送</h3><p>  插件：<a target="_blank" rel="noopener" href="https://github.com/huiwang/hexo-baidu-url-submit">hexo-baidu-url-submit</a><br>  安装插件：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-baidu-url-submit <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<p>  在<code>站点配置文件</code>中添加以下代码：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token comment"># 百度主动推送</span>
<span class="token key atrule">baidu_url_submit</span><span class="token punctuation">:</span>
  <span class="token key atrule">count</span><span class="token punctuation">:</span> <span class="token number">5</span> <span class="token comment">## 提交最新的1个链接</span>
  <span class="token key atrule">host</span><span class="token punctuation">:</span> tding.top <span class="token comment">## 百度站长平台中注册的域名</span>
  <span class="token key atrule">token</span><span class="token punctuation">:</span> <span class="token comment">## 准入秘钥</span>
  <span class="token key atrule">path</span><span class="token punctuation">:</span> baidu_urls.txt <span class="token comment">## 文本文档的地址， 新链接会保存在此文本文档里</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h3 id="站点地图"><a href="#站点地图" class="headerlink" title="站点地图"></a>站点地图</h3><ol>
<li>通用站点地图<br>  地址：<a target="_blank" rel="noopener" href="https://github.com/hexojs/hexo-generator-sitemap">hexo-generator-sitemap</a><br>  安装配置：<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-generator-sitemap <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
  然后我们需要在 Hexo <code>站点配置文件</code>中加入 sitemap 插件：<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token comment"># 通用站点地图</span>
<span class="token key atrule">sitemap</span><span class="token punctuation">:</span>
  <span class="token key atrule">path</span><span class="token punctuation">:</span> sitemap.xml<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span></span></code></pre></li>
<li>百度站点地图<br>  地址：<a target="_blank" rel="noopener" href="https://github.com/coneycode/hexo-generator-baidu-sitemap">hexo-generator-baidu-sitemap</a><br>  安装配置：<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-generator-baidu-sitemap <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
  具体配置类似通用站点地图，当然也可以看官方提供的教程，下面是一个简单的配置，我们在 Hexo <code>站点配置文件</code>中添加：<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token comment"># 百度站点地图</span>
<span class="token key atrule">baidusitemap</span><span class="token punctuation">:</span>
  <span class="token key atrule">path</span><span class="token punctuation">:</span> baidusitemap.xml<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span></span></code></pre></li>
</ol>
<h3 id="文章置顶插件"><a href="#文章置顶插件" class="headerlink" title="文章置顶插件"></a>文章置顶插件</h3><p>  地址：<a target="_blank" rel="noopener" href="https://github.com/netcan/hexo-generator-index-pin-top">hexo-generator-index-pin-top</a><br>  安装插件：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> uninstall hexo-generator-index <span class="token parameter variable">--save</span> <span class="token comment">#卸载原来的插件</span>
<span class="token function">npm</span> <span class="token function">install</span> hexo-generator-index-pin-top <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span></span></code></pre>
<p>  在需要置顶的文章的 <code>Front-matter</code> 中加上 <code>top: true</code> 或者 <code>top: 任意数字</code>，比如：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token key atrule">title</span><span class="token punctuation">:</span> 谢谢你来看我的博客
<span class="token key atrule">top</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
<span class="token key atrule">header</span><span class="token punctuation">:</span> <span class="token boolean important">false</span>
<span class="token key atrule">abbrlink</span><span class="token punctuation">:</span> a8863134
<span class="token key atrule">date</span><span class="token punctuation">:</span> <span class="token datetime number">2020-02-01 12:10:10</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p><code>注意：top 中数字越大，文章越靠前。</code><br>  设置置顶图标:<br>  更新为将此代码放置到 <code>hexo/source/_data/post-meta.swig</code> 文件中:</p>
<pre class="line-numbers language-none"><code class="language-none">{# 添加置顶显示 #}
{%- if post.top &gt; 0 %}
    &lt;span class="post-meta-item"&gt;
        &lt;span class="post-meta-item-icon post-sticky-flag"&gt;
          &lt;i class="fa fa-thumbtack" style="color:Tomato"&gt;&lt;/i&gt;
        &lt;/span&gt;
        &lt;span class="post-meta-item-text" style="color:Tomato;font-weight:bold;"&gt;
          &lt;i class="article-topping"&gt;{{ __('post.sticky') }}&lt;/i&gt;
        &lt;/span&gt;
    &lt;/span&gt;
{%- endif %}<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>  <code>_config.next.yml</code> 设置:</p>
<pre class="line-numbers language-diff" data-language="diff"><code class="language-diff">custom_file_path:
<span class="token deleted-sign deleted"><span class="token prefix deleted">-</span><span class="token line">  #postMeta: source/_data/post-meta.swig
</span></span><span class="token inserted-sign inserted"><span class="token prefix inserted">+</span><span class="token line">  postMeta: source/_data/post-meta.swig</span></span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span></span></code></pre>

<h3 id="静态资源压缩插件"><a href="#静态资源压缩插件" class="headerlink" title="静态资源压缩插件"></a>静态资源压缩插件</h3><p>  地址:<a target="_blank" rel="noopener" href="https://github.com/rozbo/hexo-neat">hexo-neat</a><br>  安装插件：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-neat <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<p>  然后我们需要在<code>站点配置</code>文件中添加以下代码：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token comment"># 博文压缩</span>
<span class="token key atrule">neat_enable</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
<span class="token comment"># 压缩html</span>
<span class="token key atrule">neat_html</span><span class="token punctuation">:</span>
  <span class="token key atrule">enable</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token key atrule">exclude</span><span class="token punctuation">:</span>
<span class="token comment"># 压缩css</span>
<span class="token key atrule">neat_css</span><span class="token punctuation">:</span>
  <span class="token key atrule">enable</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token key atrule">exclude</span><span class="token punctuation">:</span>
    <span class="token punctuation">-</span> <span class="token string">'**/*.min.css'</span>
<span class="token comment"># 压缩js</span>
<span class="token key atrule">neat_js</span><span class="token punctuation">:</span>
  <span class="token key atrule">enable</span><span class="token punctuation">:</span> <span class="token boolean important">false</span>
  <span class="token key atrule">mangle</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token key atrule">output</span><span class="token punctuation">:</span>
  <span class="token key atrule">compress</span><span class="token punctuation">:</span>
  <span class="token key atrule">exclude</span><span class="token punctuation">:</span>
    <span class="token punctuation">-</span> <span class="token string">'**/*.min.js'</span>
    <span class="token punctuation">-</span> <span class="token string">'**/jquery.fancybox.pack.js'</span>
    <span class="token punctuation">-</span> <span class="token string">'**/index.js'</span>
    <span class="token punctuation">-</span> <span class="token string">'**/fireworks.js'</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h3 id="推荐文章插件"><a href="#推荐文章插件" class="headerlink" title="推荐文章插件"></a>推荐文章插件</h3><p>  地址:<a target="_blank" rel="noopener" href="https://github.com/tea3/hexo-related-popular-posts">hexo-related-popular-posts</a><br>  安装插件：</p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-related-popular-posts <span class="token parameter variable">--save</span><span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<p>  我们只需要在<code>主题配置</code>文件中修改：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token key atrule">related_posts</span><span class="token punctuation">:</span>
  <span class="token key atrule">enable</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token key atrule">title</span><span class="token punctuation">:</span> 相关文章推荐 <span class="token comment"># Custom header, leave empty to use the default one</span>
  <span class="token key atrule">display_in_home</span><span class="token punctuation">:</span> <span class="token boolean important">false</span>
  <span class="token key atrule">params</span><span class="token punctuation">:</span>
    <span class="token key atrule">maxCount</span><span class="token punctuation">:</span> <span class="token number">5</span>
    <span class="token key atrule">PPMixingRate</span><span class="token punctuation">:</span> <span class="token number">0.25</span>
    <span class="token key atrule">isDate</span><span class="token punctuation">:</span> <span class="token boolean important">false</span>
    <span class="token key atrule">isImage</span><span class="token punctuation">:</span> <span class="token boolean important">false</span>
    <span class="token key atrule">isExcerpt</span><span class="token punctuation">:</span> <span class="token boolean important">false</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<h3 id="emoji-表情支持"><a href="#emoji-表情支持" class="headerlink" title="emoji 表情支持"></a>emoji 表情支持</h3><p>  地址:<a target="_blank" rel="noopener" href="https://github.com/next-theme/hexo-filter-emoji">hexo-filter-emoji</a><br>  <a target="_blank" rel="noopener" href="https://www.webfx.com/tools/emoji-cheat-sheet/">图标</a><br>  安装插件: </p>
<pre class="line-numbers language-bash" data-language="bash"><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> hexo-filter-emoji<span aria-hidden="true" class="line-numbers-rows"><span></span></span></code></pre>
<p>  站点配置文件 <code>.config.yml</code> 中增加：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token key atrule">emoji</span><span class="token punctuation">:</span>
  <span class="token key atrule">enable</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token key atrule">className</span><span class="token punctuation">:</span> github<span class="token punctuation">-</span>emoji
  <span class="token key atrule">styles</span><span class="token punctuation">:</span>
  customEmojis<span class="token punctuation">:</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<p>  或者</p>
<p><code>hexo-filter-github-emojis</code></p>
<h3 id="加密插件"><a href="#加密插件" class="headerlink" title="加密插件"></a>加密插件</h3><p>  地址：<a target="_blank" rel="noopener" href="https://github.com/MikeCoder/hexo-blog-encrypt">hexo-blog-encrypt</a><br>  我们需要在文章开头添加：</p>
<pre class="line-numbers language-diff" data-language="diff"><code class="language-diff"><span class="token coord">---</span>
title: 射频微波基础知识（二）
declare: true
toc: true
tags:
<span class="token unchanged"><span class="token prefix unchanged"> </span><span class="token line"> - 射频电路
</span></span>categories:
<span class="token unchanged"><span class="token prefix unchanged"> </span><span class="token line"> - RF
</span><span class="token prefix unchanged"> </span><span class="token line"> - 射频电路
</span></span>mathjax: true
<span class="token inserted-sign inserted"><span class="token prefix inserted">+</span><span class="token line">password: 
</span><span class="token prefix inserted">+</span><span class="token line">abstract: 有东西被加密了，请输入密码查看
</span><span class="token prefix inserted">+</span><span class="token line">message: 请输入密码
</span></span><span class="token coord">---</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>

<h3 id="侧栏头像动画"><a href="#侧栏头像动画" class="headerlink" title="侧栏头像动画"></a>侧栏头像动画</h3><p>  先从简单的开始吧！修改头像其实很简单，直接把头像放进 <code>next/source/images/</code> 下，然后再主题配置文件中，找到以下部分：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token comment"># Sidebar Avatar</span>
<span class="token key atrule">avatar</span><span class="token punctuation">:</span>
  <span class="token comment"># In theme directory (source/images): /images/avatar.gif</span>
  <span class="token comment"># In site directory (source/uploads): /uploads/avatar.gif</span>
  <span class="token comment"># You can also use other linking images.</span>
  <span class="token key atrule">url</span><span class="token punctuation">:</span> /images/avatar.jpg
  <span class="token comment"># If true, the avatar would be dispalyed in circle.</span>
  <span class="token key atrule">rounded</span><span class="token punctuation">:</span> <span class="token boolean important">true</span>
  <span class="token comment"># The value of opacity should be choose from 0 to 1 to set the opacity of the avatar.</span>
  <span class="token key atrule">opacity</span><span class="token punctuation">:</span> <span class="token number">1</span>
  <span class="token comment"># If true, the avatar would be rotated with the cursor.</span>
  <span class="token key atrule">rotated</span><span class="token punctuation">:</span> <span class="token boolean important">true</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>  在 <code>url</code> 处指定头像文件即可，头像可以是网络图片，只需要把本地路径替换为网络图片的网址即可。另外，当打开了 <code>rotated</code> 后，鼠标移到头像处会逆时针旋转半圈，鼠标移开又转回来，不过这个效果看起来好像也比较普通，如果你想让鼠标一过去头像就控记不住记几鬼畜疯狂旋转，就像这样：</p>
<img data-src="/post/dfea82e5/avatar_rotate_hover.gif" class="" title="hover">
<p>  请找到这个文件并愤怒地打开它：<code>source/_data/styles.styl</code>，然后做如下部分修改：</p>
<pre class="line-numbers language-css" data-language="css"><code class="language-css"><span class="token selector">if hexo-config('avatar.rotated')</span> <span class="token punctuation">{</span>
  <span class="token selector">.site-author-image</span> <span class="token punctuation">{</span>
    <span class="token property">transition</span><span class="token punctuation">:</span> transform 1.0s ease-out<span class="token punctuation">;</span>
    <span class="token comment">/*animation: rotate 5s linear infinite;*/</span>
  <span class="token punctuation">}</span>
  <span class="token comment">/*@keyframes rotate{from{transform: rotate(0deg)}
  to{transform: rotate(360deg)}
  }*/</span>

  <span class="token comment">/* 原本只是简单地逆时针旋转 180°
  .site-author-image:hover {
    transform: rotateZ(-180deg);
  }
  */</span>
  <span class="token selector">.site-author-image:hover</span> <span class="token punctuation">{</span>
    <span class="token property">animation</span><span class="token punctuation">:</span> rotate 0.15s linear infinite<span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
  <span class="token atrule"><span class="token rule">@keyframes</span> rotate</span><span class="token punctuation">{</span><span class="token selector">from</span><span class="token punctuation">{</span><span class="token property">transform</span><span class="token punctuation">:</span> <span class="token function">rotate</span><span class="token punctuation">(</span>0deg<span class="token punctuation">)</span><span class="token punctuation">}</span>
  <span class="token selector">to</span><span class="token punctuation">{</span><span class="token property">transform</span><span class="token punctuation">:</span> <span class="token function">rotate</span><span class="token punctuation">(</span>360deg<span class="token punctuation">)</span><span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>  <code>.site-author-image:hover</code> 就是鼠标覆盖上去时的代码，代码的意思就是：动画是 rotate，时间是 0.15 秒（也即 0.15 秒转一圈），动画速度是线性，动画重复无限次，在下方定义了旋转的角度是从 0 ~ 360°，其中正数是顺时针旋转，负数是逆时针旋转。设置完了以后别忘了 Hexo 三连一下试试效果。如果你不想这么鬼畜，想走文艺路线，就换一下注释并且让它转的缓慢一点唱片式旋转，变成：</p>
<pre class="line-numbers language-css" data-language="css"><code class="language-css"><span class="token selector">if hexo-config('avatar.rotated')</span> <span class="token punctuation">{</span>
  <span class="token selector">.site-author-image</span> <span class="token punctuation">{</span>
    <span class="token property">transition</span><span class="token punctuation">:</span> transform 1.0s ease-out<span class="token punctuation">;</span>
    <span class="token property">animation</span><span class="token punctuation">:</span> rotate 5s linear infinite<span class="token punctuation">;</span>
  <span class="token punctuation">}</span>
  <span class="token atrule"><span class="token rule">@keyframes</span> rotate</span><span class="token punctuation">{</span><span class="token selector">from</span><span class="token punctuation">{</span><span class="token property">transform</span><span class="token punctuation">:</span> <span class="token function">rotate</span><span class="token punctuation">(</span>0deg<span class="token punctuation">)</span><span class="token punctuation">}</span>
  <span class="token selector">to</span><span class="token punctuation">{</span><span class="token property">transform</span><span class="token punctuation">:</span> <span class="token function">rotate</span><span class="token punctuation">(</span>360deg<span class="token punctuation">)</span><span class="token punctuation">}</span>
  <span class="token punctuation">}</span>

  <span class="token selector">.site-author-image:hover</span> <span class="token punctuation">{</span>
    <span class="token comment">/*animation: rotate 0.15s linear infinite;*/</span>
  <span class="token punctuation">}</span>
  <span class="token comment">/*@keyframes rotate{from{transform: rotate(0deg)}
  to{transform: rotate(360deg)}
  }*/</span>
<span class="token punctuation">}</span><span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<img data-src="/post/dfea82e5/avatar_rotate_normal.gif" class="" title="hover">

<h3 id="languages-yml"><a href="#languages-yml" class="headerlink" title="languages.yml"></a>languages.yml</h3><p>  我们原来是通过配置主题下的 <code>languages</code> 目录中的 <code>zh-CN.yml</code> 文件来对菜单等进行中文翻译的，现在我们可以通过在 <code>hexo/source/_data/</code> 下新建数据文件 <code>languages.yml</code>，配置如下：</p>
<pre class="line-numbers language-yaml" data-language="yaml"><code class="language-yaml"><span class="token key atrule">zh-CN</span><span class="token punctuation">:</span>
  <span class="token key atrule">menu</span><span class="token punctuation">:</span>
    <span class="token key atrule">home</span><span class="token punctuation">:</span> 首页
    <span class="token key atrule">archives</span><span class="token punctuation">:</span> 归档
    <span class="token key atrule">categories</span><span class="token punctuation">:</span> 分类
    <span class="token key atrule">tags</span><span class="token punctuation">:</span> 标签
    <span class="token key atrule">about</span><span class="token punctuation">:</span> 关于
    <span class="token key atrule">search</span><span class="token punctuation">:</span> 搜索
    <span class="token key atrule">schedule</span><span class="token punctuation">:</span> 日程表
    <span class="token key atrule">sitemap</span><span class="token punctuation">:</span> 站点地图
    <span class="token key atrule">commonweal</span><span class="token punctuation">:</span> 公益 404
    <span class="token key atrule">message</span><span class="token punctuation">:</span> 留言
    <span class="token key atrule">links</span><span class="token punctuation">:</span> 友情链接

  <span class="token key atrule">reward</span><span class="token punctuation">:</span>
    <span class="token key atrule">donate</span><span class="token punctuation">:</span> 打赏
    <span class="token key atrule">wechatpay</span><span class="token punctuation">:</span> 微信支付
    <span class="token key atrule">alipay</span><span class="token punctuation">:</span> 支付宝
    <span class="token key atrule">paypal</span><span class="token punctuation">:</span> 贝宝
    <span class="token key atrule">bitcoin</span><span class="token punctuation">:</span> 比特币<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>


<hr>

<blockquote>
<p>其他博客<br><a target="_blank" rel="noopener" href="https://www.simon96.online/">遇见西门</a><br><a target="_blank" rel="noopener" href="https://zhousiwei.gitee.io/">試毅-思伟</a><br><a target="_blank" rel="noopener" href="https://blog.dlzhang.com/">班班碎碎念</a><br><a target="_blank" rel="noopener" href="https://me.idealli.com/">小红鸡</a></p>
</blockquote>
<hr>

<blockquote>
<p>其他相关链接<br><a target="_blank" rel="noopener" href="https://www.simon96.online/2018/10/12/hexo-tutorial/">[持续更新]最全Hexo博客搭建+主题优化+插件配置+常用操作+错误分析</a><br><a target="_blank" rel="noopener" href="https://github.com/coneycode/hexo-git-backup">hexo-git-backup</a><br><a target="_blank" rel="noopener" href="https://www.hojun.cn/2018/01/25/Hexo%E5%8D%9A%E5%AE%A2%E5%A4%87%E4%BB%BD%E2%80%94%E5%A6%88%E5%A6%88%E5%86%8D%E4%B9%9F%E4%B8%8D%E7%94%A8%E6%8B%85%E5%BF%83%E4%BD%A0%E4%BD%BF%E7%94%A8hexo%E5%86%99%E5%8D%9A%E5%AE%A2/">Hexo博客备份</a><br><a target="_blank" rel="noopener" href="https://notes.doublemine.me/2015-07-06-%E8%87%AA%E5%8A%A8%E5%A4%87%E4%BB%BDHexo%E5%8D%9A%E5%AE%A2%E6%BA%90%E6%96%87%E4%BB%B6.html">Doublemine</a><br><a target="_blank" rel="noopener" href="https://www.dazhuanlan.com/2019/10/25/5db2632c401b8/">大专栏</a></p>
</blockquote>
<link rel="stylesheet" href="/css/spoiler.css" type="text/css"><script src="/js/spoiler.js" type="text/javascript" async></script>
    </div>

    
    
    

    <footer class="post-footer">
<div style="padding-top: 26px;">
    

    <div class="endlan">
        <i></i>
        <p>本文结束--- <img src="https://static.xiaosige.com/img/logo.png" style="display:inline-block;margin-bottom:-7px;height: 25px;"> ---感谢您的阅读</p>
    </div>


    <p id="hitokoto" style="text-align:center;margin-top: 30px;font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, STKaiti, KaiTi, SimKai, DFKai-SB, 'Lato', 'PingFang SC', 'Microsoft YaHei', sans-serif;font-weight: bold;color: #999;">
     正在加载一言...
    </p>
    <div style="margin-top: 30px;">
      <img id="wechat_subscriber_qcode" src="https://static.xiaosige.com/img/reward-container-back.png" alt="leeze wechat" style="max-width: 100%;">
    </div>
    

    
</div>


          <div class="reward-container">
  <div>请我一杯咖啡吧！</div>
  <button>
    打赏
  </button>
  <div class="post-reward">
      <div>
        <img src="https://static.xiaosige.com/img/wechatpay.png" alt="leeze 微信支付">
        <span>微信支付</span>
      </div>
      <div>
        <img src="https://static.xiaosige.com/img/alipay.png" alt="leeze 支付宝">
        <span>支付宝</span>
      </div>

  </div>
</div>

          

<div class="post-copyright">
<ul>
  <li class="post-copyright-author">
      <strong>原文作者： </strong>leeze
  </li>
  <li class="post-copyright-link">
      <strong>本文链接：</strong>
      <a href="https://www.xiaosige.com/post/dfea82e5.html" title="Hexo之搭建个人博客">https://www.xiaosige.com/post/dfea82e5.html</a>
  </li>
  <li class="post-copyright-license">
      <strong>版权声明： </strong>本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/zh-CN" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处！
  </li>
</ul>
</div>

          <div class="post-tags">
              <a href="/tags/hexo/" rel="tag"><i class="fa fa-tag"></i> hexo</a>
          </div>

        

          <div class="post-nav">
            <div class="post-nav-item">
                <a href="/post/9c39465b.html" rel="prev" title="Markdown 编辑器日常使用语法记录">
                  <i class="fa fa-angle-left"></i> Markdown 编辑器日常使用语法记录
                </a>
            </div>
            <div class="post-nav-item">
                <a href="/post/4a17b156.html" rel="next" title="Hello World">
                  Hello World <i class="fa fa-angle-right"></i>
                </a>
            </div>
          </div>
    </footer>
  </article>
</div>






    <div class="comments" id="SOHUCS" sid="f0aedeb2b7dfe0816455fce3a4172f93"></div>
</div>
  </main>

  <footer class="footer">
    <div class="footer-inner">

  <div class="copyright">
    &copy; 
    <span itemprop="copyrightYear">2025</span>
    <span class="with-love">
      <i class="fa fa-heart"></i>
    </span>
    <span class="author" itemprop="copyrightHolder">Xiaosige.com 版权所有</span>
  </div>
<div class="wordcount">
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-chart-line"></i>
    </span>
    <span title="站点总字数">435k</span>
  </span>
  <span class="post-meta-item">
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
    <span title="站点阅读时长">6:35</span>
  </span>
</div>
<div class="busuanzi-count">
    <span class="post-meta-item" id="busuanzi_container_site_uv">
      <span class="post-meta-item-icon">
        <i class="fa fa-user"></i>
      </span>
      <span class="site-uv" title="总访客量">
        <span id="busuanzi_value_site_uv"></span>
      </span>
    </span>
    <span class="post-meta-item" id="busuanzi_container_site_pv">
      <span class="post-meta-item-icon">
        <i class="fa fa-eye"></i>
      </span>
      <span class="site-pv" title="总访问量">
        <span id="busuanzi_value_site_pv"></span>
      </span>
    </span>
</div>



<div calss="ypy" style="text-align:center;display:none;">
    本网站由
    <a target="_blank" rel="nofollow noopener" href="https://www.upyun.com/?utm_source=lianmeng&utm_medium=referral" style="border-bottom:none;">
        <img src="https://static.xiaosige.com/img/ypy_logo.png" style="display:inline-block;margin-bottom:-7px;height: 25px;-webkit-filter: brightness(.8);filter: brightness(.8);">
    </a>
    提供CDN加速/云存储服务
</div>


  <div class="beian">
          <img src="https://static.xiaosige.com/img/gongan.png" style="display: inline-block;vertical-align: text-bottom;padding-right: 6px;"><a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=11011502004362" rel="noopener" target="_blank">京公网安备 11011502004362 </a>
    <span></span><a href="http://beian.miit.gov.cn/" rel="noopener" target="_blank">京ICP备2020038036号-1 </a>
    <span></span>
    本网站由
    <a target="_blank" rel="nofollow noopener" href="https://www.upyun.com/?utm_source=lianmeng&utm_medium=referral" style="border-bottom:none;">
        <img src="https://static.xiaosige.com/img/ypy_logo.png" style="display:inline-block;margin-bottom:-7px;height: 25px;-webkit-filter: brightness(.8);filter: brightness(.8);">
    </a>
    提供CDN加速/云存储服务
  </div>


<link href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/meting@2.0.1/dist/Meting.min.js"></script>
<meting-js server="netease" type="playlist" id="2228518256" fixed="true" autoplay="false" order="random" lrc-type=1  theme="#eb7aab"></meting-js>


<div class="bg-box" id="bg-box1"></div>
<div class="bg-box" id="bg-box2"></div>
<style>
.bg-box {
 background-repeat:no-repeat;
 background-attachment:fixed;
 background-position:50% 50%;
 background-size:cover;
 position:fixed;
 left:0;
 right:0;
 top:0;
 bottom:0
}
#bg-box1 {
 z-index:-998
}
#bg-box2 {
 z-index:-999
}
</style>




    </div>
  </footer>

  
  <div class="toggle sidebar-toggle" role="button">
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
    <span class="toggle-line"></span>
  </div>
  <div class="sidebar-dimmer"></div>

<noscript>
  <div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>
<script class="next-config" data-name="changyan" type="application/json">{"enable":true,"appid":"cyvSPOTJq","appkey":"4436699688bbb9caa6e8826551a7c0f7"}</script>
<script src="/js/third-party/comments/changyan.js" defer></script>
<!-- 提示信息 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-toast-plugin@1.3.2/dist/jquery.toast.min.css"/>
<script src="https://cdn.jsdelivr.net/npm/jquery-toast-plugin@1.3.2/dist/jquery.toast.min.js"></script>
<!-- 樱花特效(https://cdn.jsdelivr.net/gh/yremp/yremp-js@1.5/sakura.js) -->
<!-- 下雪(圣诞) -->

<!-- 天气 -->

<!-- 文字闪烁（变色） -->
<script>
function magicColor(mode,t){
  t=t||10;
  let elem=document.getElementsByClassName("magic-color");
  if(!elem){
      setTimeout(function(){
          magicColor(mode,t-1);
      },400);
      return;
  }
  if(window.mcHandler==undefined){
      window.mcHandler={elements:[]};
      window.mcHandler.colorIndex=0;
      window.mcHandler.run=function(mode){
          let color=mode=="random"?("rgb("+Math.floor(Math.random()*256)+","+Math.floor(Math.random()*256)+","+Math.floor(Math.random()*256)+",1)"):["#CC0000","#9999CC","#CC3366","#669999","#FFCC00","#00CCCC","#CC00CC"][(window.mcHandler.colorIndex++)%7];
          for(var i=0,L=window.mcHandler.elements.length;i<L;i++)window.mcHandler.elements[i].style.color=color;
      }
  }
  window.mcHandler.elements=elem;
  if(window.mcHandler.timer==undefined){
      window.mcHandler.timer=setInterval(()=>{window.mcHandler.run(mode)},500);
  }
}
magicColor("random");//random为随机颜色，否则为固定颜色随机；上方“闪烁（变色）”字样为固定颜色随机
</script>


<!-- 一言API -->
<!-- 现代写法，推荐 -->
<!-- 兼容低版本浏览器 (包括 IE)，可移除 -->
<script src="https://cdn.jsdelivr.net/npm/bluebird@3.7.2/js/browser/bluebird.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/fetch@1.1.0/lib/fetch.min.js"></script>
<!--End-->
<script>
fetch('https://v1.hitokoto.cn')
  .then(function (res){
    return res.json();
  })
  .then(function (data) {
    var hitokoto = document.getElementById('hitokoto');
    if(hitokoto){
      hitokoto.innerHTML = "<i class='fa fa-volume-up magic-color' style='margin-right:6px;'></i>" + data.hitokoto + '——【' + data.from + '】';
    }
  })
  .catch(function (err) {
    console.error(err);
  })
</script>


<!-- 代码块自动隐藏 -->
<script>
$(function(){
    const CODE_MAX_HEIGHT = 200;
    const containers = [];

    // 展开
    $('body').on('click', '.js_unfold_code_btn', function () {
        $(this).closest('.js_highlight_container').addClass('on');
    });
    // 收起
    $('body').on('click', '.js_retract_code_btn', function () {
        const $container = $(this).closest('.js_highlight_container').removeClass('on');
        const winTop = $(window).scrollTop();
        const offsetTop = $container.offset().top;
        $(this).css('top', 0);
        if (winTop > offsetTop) {
            // 设置滚动条位置
            $('body, html').animate({
                scrollTop: $container.offset().top - CODE_MAX_HEIGHT
            }, 600);
        }
    });
    // 滚动事件，触发动画效果
    $(window).on('scroll', function () {
        const scrollTop = $(window).scrollTop();
        const temp = [];
        for (let i = 0; i < containers.length; i++) {
            const item = containers[i];
            const { $container, height, $hide, hasHorizontalScrollbar } = item;
            if ($container.closest('body').length === 0) {
                // 如果 $container 元素已经不在页面上, 则删除该元素
                // 防止pjax页面跳转之后，元素未删除
                continue;
            }
            temp.push(item);
            if (!$container.hasClass('on')) {
                continue;
            }
            const offsetTop = $container.offset().top;
            const hideBtnHeight = $hide.outerHeight();
            // 减去按钮高度，减去底部滚动条高度
            const maxTop = parseInt(height - (hasHorizontalScrollbar ? 17 : 0) - hideBtnHeight);
            let top = parseInt(
                Math.min(
                    Math.max(scrollTop - offsetTop, 0), // 如果小于 0 ，则取 0
                    maxTop,// 如果大于 height ，则取 height
                )
            );
            // 根据 sin 曲线设置"收起阅读"位置
            const halfHeight = parseInt($(window).height() / 2 * Math.sin((top / maxTop) * 90 * (2 * Math.PI/360)));
            $hide.css('top', Math.min(top + halfHeight, maxTop));
        }
        //containers = temp;
    });

    // 添加隐藏容器
    const addCodeWrap = ($node) => {
        const $container = $node.wrap('<div class="js_highlight_container highlight-container"><div class="highlight-wrap"></div></div>').closest('.js_highlight_container');

        // 底部 "阅读更多" 与 侧边栏 "收起阅读"
        const $btn = $(`
        <div class="highlight-footer">
          <a class="js_unfold_code_btn show-btn" href="javascript:;">
              <span class="btn-inner">
                阅读更多<i class="fa fa-angle-right fa-lg" aria-hidden="true"></i>
              </span>
              <div class="btnbg-x"></div>
          </a>
        </div>
        <a class="js_retract_code_btn hide-btn" href="javascript:;"><i class="fa fa-angle-up fa-lg" aria-hidden="true"></i>收起阅读</a>
      `);

        $container.append($btn);
        return $container;
    };

    $('.highlight').each(function () {
        // 防止重复渲染
        if (this.__render__ === true) {
            return true;
        }
        this.__render__ = true;
        const $this = $(this);
        const height = $(this).outerHeight();
        if (height > CODE_MAX_HEIGHT) {
            // 添加展开&收起容器
            const $container = addCodeWrap($this, height);
            containers.push({
                $container,
                height,
                $hide: $container.find('.js_retract_code_btn'),
                hasHorizontalScrollbar: this.scrollWidth > this.offsetWidth,
            });
        }
    });

    $('.line-numbers').each(function () {
        // 防止重复渲染
        if (this.__render__ === true) {
            return true;
        }
        this.__render__ = true;
        const $this = $(this);
        const height = $(this).outerHeight();
        if (height > CODE_MAX_HEIGHT) {
            // 添加展开&收起容器
            const $container = addCodeWrap($this, height);
            containers.push({
                $container,
                height,
                $hide: $container.find('.js_retract_code_btn'),
                hasHorizontalScrollbar: this.scrollWidth > this.offsetWidth,
            });
        }
    });

    $('.table-container').each(function () {
        // 防止重复渲染
        if (this.__render__ === true) {
            return true;
        }
        this.__render__ = true;
        const $this = $(this);
        const height = $(this).outerHeight();
        if (height > CODE_MAX_HEIGHT) {
            // 添加展开&收起容器
            const $container = addCodeWrap($this, height);
            containers.push({
                $container,
                height,
                $hide: $container.find('.js_retract_code_btn'),
                hasHorizontalScrollbar: this.scrollWidth > this.offsetWidth,
            });
        }
    });

});
</script>


<script  type="text/javascript">

layui.use(['jquery', 'layer'], function(){

  var $ = layui.$,layer = layui.layer;

  <!-- wobble窗口摆动特效 -->
  


     var wobbleWindow = function(object, params) {
          var canvas,
              ctx;
          var mousePos = {
              x: 0,
              y: 0
          };
          var isResizing = false;
          var delayId = 0;
          var canvasContent = {};
          var points = {};

          var settings = {};
          settings.name = 'wobblew'; //name
          settings.position = 'relative'; //relative or absolute
          settings.depth = -1; //depth for zIndex
          settings.overflowX = 'visible';
          settings.overflowY = 'visible';
          settings.offsetX = 0; //+ or - value the size of the div
          settings.offsetY = 0; //+ or - value the size of the div
          settings.moveTypeIn = 'move'; //method points follow the mouse
          settings.moveTypeOut = 'wobble'; //method points go back to init position
          settings.wobbleFactor = 0.95; //control the wobble effect
          settings.wobbleSpeed = 0.1; //control the wobble effect
          settings.moveSpeed = 6; //control the move speed
          settings.lineWidth = 1; //lineWidth

          settings.transplantLineColor = false; //true Use Object border-color
          settings.lineColor = ''; //no value = no line. Use hex/rgba values
          settings.transplantBodyColor = true; //true Use Object background Color
          settings.bodyColor = ''; //no value = no body color. Use hex/rgba values
          settings.radius = 50; //
          settings.pointCountX = 7; //quantity of points horizontal. must be an odd int
          settings.pointCountY = 5; //quantity of points vertical. must be an odd int
          settings.movementLeft = true; //enable/disable movement directions
          settings.movementRight = true; //enable/disable movement directions
          settings.movementTop = true; //enable/disable movement directions
          settings.movementBottom = true; //enable/disable movement directions
          settings.autoResize = true; //if true size will be automatically adjusted
          settings.debug = false; //enable/disable debug mode

          // ---
          if (params !== undefined) {
              for (var prop in params) {
                  if (params.hasOwnProperty(prop) && settings.hasOwnProperty(prop)) {
                      settings[prop] = params[prop];
                  }
              }
          }

          // ---
          if (!object) {
              throw Error('\n' + 'No div element found');
          }
          if ((settings.pointCountX % 2) === 0) {
              throw Error('\n' + 'Param pointCountX must be an odd integer');
          }
          if ((settings.pointCountY % 2) === 0) {
              throw Error('\n' + 'Param pointCountY must be an odd integer');
          }

          // ---
          HTMLElement.prototype.__defineGetter__("currentStyle", function() {
              return this.ownerDocument.defaultView.getComputedStyle(this, null);
          });
          // ---
          function init() {
              canvas = document.createElement('canvas');
              canvas.id = settings.name;
              canvas.style.position = 'absolute';
              canvas.style.zIndex = settings.depth.toString();
              canvas.addEventListener('mousemove', mouseMoveHandler);
              canvas.addEventListener('mouseleave', mouseLeaveHandler);
              ctx = canvas.getContext('2d');

              // element.insertBefore(canvas, element.firstChild);
              object.appendChild(canvas);
              object.style.position = settings.position;
              object.style.zIndex = (settings.depth + 1).toString();
              if (settings.overflowX.length > 0) {
                  object.parentElement.style.overflowX = settings.overflowX;
              };
              if (settings.overflowY.length > 0) {
                  object.parentElement.style.overflowY = settings.overflowY;
              };
              if (settings.transplantBodyColor) {
                  if (object.currentStyle.backgroundColor.length > 0) {
                      settings.bodyColor = object.currentStyle.backgroundColor;
                  }
              };
              if (settings.transplantLineColor) {
                  if (object.currentStyle.borderColor.length > 0) {
                      settings.lineColor = object.currentStyle.borderColor;
                  }
              };
              canvasContent.elementWidth = object.offsetWidth;
              canvasContent.elementHeight = object.offsetHeight;
              // ---
              resizeCanvas();
              addWindow();
              animloop();
              // -----------
              if (settings.transplantBodyColor) {
                  if (object.currentStyle.backgroundColor.length > 0) {
                      if (object.className.length > 0) {
                          object.className += ' wobbleTransparentBK';
                      } else {
                          object.className = ' wobbleTransparentBK';
                      };
                  }
              };
              if (settings.transplantLineColor) {
                  if (object.currentStyle.borderColor.length > 0) {
                      if (object.className.length > 0) {
                          object.className += ' wobbleTransparentLine';
                      } else {
                          object.className = ' wobbleTransparentLine';
                      };
                  }
              };
          };

          // ---
          function resizeCanvas() {
              canvasContent.width = canvasContent.elementWidth + settings.offsetX * 2;
              canvasContent.height = canvasContent.elementHeight + settings.offsetY * 2;

              if (settings.radius > 0) { //round,  ceil
                  settings.pointCountX = Math.round(canvasContent.width / settings.radius);
                  settings.pointCountY = Math.round(canvasContent.height / settings.radius);
              };
              if (settings.pointCountX % 2 == 0) {
                  settings.pointCountX = settings.pointCountX + 1;
              };
              if (settings.pointCountY % 2 == 0) {
                  settings.pointCountY = settings.pointCountY + 1;
              };

              points.spaceX = Math.min(canvasContent.elementWidth, canvasContent.width / (settings.pointCountX - 1));
              points.spaceY = Math.min(canvasContent.elementHeight, canvasContent.height / (settings.pointCountY + 1));
              points.radius = Math.ceil(Math.max(points.spaceX, points.spaceY));

              ///--------------new1------------------
              canvasContent.left = 0;
              canvasContent.top = 0;
              settings.canvasWidth = canvasContent.elementWidth;
              if (settings.movementLeft) {
                  canvas.style.left = -points.radius + 'px';
                  settings.canvasWidth += points.radius;
                  canvasContent.left = points.radius - settings.offsetX;
              } else {
                  canvas.style.left = -settings.offsetX + 'px';
              };
              if (settings.movementRight)
                  settings.canvasWidth += points.radius;

              settings.canvasHeight = canvasContent.elementHeight;
              if (settings.movementTop) {
                  canvas.style.top = -points.radius + 'px';
                  settings.canvasHeight += points.radius;
                  canvasContent.top = points.radius - settings.offsetY;
              } else {
                  canvas.style.top = -settings.offsetY + 'px';
              };
              if (settings.movementBottom)
                  settings.canvasHeight += points.radius;

              canvas.width = settings.canvasWidth;
              canvas.height = settings.canvasHeight;
          };

          // ---
          function addWindow() {
              points.pointHolder = [];
              // ---
              var point;
              var flag;
              var i,
                  l;
              // ---
              //top
              flag = true;
              for (i = 0, l = settings.pointCountX; i < l; i++) {
                  if (settings.movementTop) {
                      if (flag) {
                          point = addPoint(canvasContent.left + i * points.spaceX, canvasContent.top, 0, 0, 0, true, points.spaceX, 'P', settings.debug);
                          flag = false;
                      } else {
                          point = addPoint(canvasContent.left + i * points.spaceX, canvasContent.top, 0, 0, 0, true, points.spaceX, 'C', settings.debug);
                          flag = true;
                      }
                      if (i === 0 || i === l - 1) {
                          point.color = '#00FF00';
                          point.movement = false;
                      }
                      points.pointHolder.push(point);
                  } else {
                      if (i === 0 || i === l - 1) {
                          point = addPoint(canvasContent.left + i * points.spaceX, canvasContent.top, 0, 0, 0, false, 0, 'P', settings.debug);
                      }
                      points.pointHolder.push(point);
                  }
              }

              // ---
              //right
              flag = false;
              for (i = 1, l = settings.pointCountY + 1; i < l; i++) {
                  if (settings.movementRight) {
                      if (flag) {
                          point = addPoint(canvasContent.left + canvasContent.width, canvasContent.top + i * points.spaceY, 0, 0, 0, true, points.spaceY, 'P', settings.debug);
                          flag = false;
                      } else {
                          point = addPoint(canvasContent.left + canvasContent.width, canvasContent.top + i * points.spaceY, 0, 0, 0, true, points.spaceY, 'C', settings.debug);
                          flag = true;
                      }
                      points.pointHolder.push(point);
                  } else {
                      if (i === 1) {
                          point = addPoint(canvasContent.left + canvasContent.width, canvasContent.top + (i - 1) * points.spaceY, 0, 0, 0, false, 0, 'P', settings.debug);
                      } else if (i === settings.pointCountY) {
                          point = addPoint(canvasContent.left + canvasContent.width, canvasContent.top + (i + 1) * points.spaceY, 0, 0, 0, false, 0, 'P', settings.debug);
                      }
                      points.pointHolder.push(point);
                  }
              }

              // ---
              //bottom
              flag = true;
              for (i = settings.pointCountX - 1, l = -1; i > l; i--) {
                  if (settings.movementBottom) {
                      if (flag) {
                          point = addPoint(canvasContent.left + i * points.spaceX, canvasContent.top + canvasContent.height, 0, 0, 0, true, points.spaceX, 'P', settings.debug);
                          flag = false;
                      } else {
                          point = addPoint(canvasContent.left + i * points.spaceX, canvasContent.top + canvasContent.height, 0, 0, 0, true, points.spaceX, 'C', settings.debug);
                          flag = true;
                      }
                      if (i === 0 || i === settings.pointCountX - 1) {
                          point.color = '#00FF00';
                          point.movement = false;
                      }
                      points.pointHolder.push(point);
                  } else {
                      if (i === 0 || i === settings.pointCountX - 1) {
                          point = addPoint(canvasContent.left + i * points.spaceX, canvasContent.top + canvasContent.height, 0, 0, 0, false, 0, 'P', settings.debug);
                      }
                      points.pointHolder.push(point);
                  }
              }

              // ---
              //left
              flag = false;
              for (i = settings.pointCountY, l = -1; i > l; i--) {
                  if (settings.movementLeft) {
                      if (flag) {
                          point = addPoint(canvasContent.left, canvasContent.top + i * points.spaceY, 0, 0, 0, true, points.spaceY, 'P', settings.debug);
                          flag = false;
                      } else {
                          point = addPoint(canvasContent.left, canvasContent.top + i * points.spaceY, 0, 0, 0, true, points.spaceY, 'C', settings.debug);
                          flag = true;
                      }
                      points.pointHolder.push(point);
                  } else {
                      if (i === 0) {
                          point = addPoint(canvasContent.left, canvasContent.top + i * points.spaceY, 0, 0, 0, false, 0, 'P', settings.debug);
                      } else if (i === settings.pointCountY) {
                          point = addPoint(canvasContent.left, canvasContent.top + (i + 1) * points.spaceY, 0, 0, 0, false, 0, 'P', settings.debug);
                      }
                      points.pointHolder.push(point);
                  }
              }
          }

          // ---
          function addPoint(x, y, xp, yp, distance, movement, radius, type, visible) {
              var point = {};
              point.x = x;
              point.y = y;
              point.xp = x;
              point.yp = y;
              point.sx = 0;
              point.sy = 0;
              point.distance = distance;
              point.movement = movement;
              point.radius = radius;
              point.type = type;
              point.visible = visible;
              return point;
          };

          // ---
          window.requestAnimFrame = (function() {
              return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) {
                  window.setTimeout(callback, 1000 / 60);
              };
          })();

          function animloop() {
              requestAnimFrame(animloop);
              render();
              if (settings.autoResize) {
                  resize();
              }
          };

          // ---
          function render() {
              ctx.clearRect(0, 0, settings.canvasWidth, settings.canvasHeight);

              // ---
              var windowPoints = points.pointHolder;
              var i,
                  l;

              // ---
              ctx.beginPath();
              ctx.moveTo(windowPoints[0].x, windowPoints[0].y);
              for (i = 1, l = windowPoints.length; i < l; i += 2) {
                  var point = windowPoints[i];

                  // ---
                  var dx = mousePos.x - point.xp;
                  var dy = mousePos.y - point.yp;
                  point.distance = Math.sqrt(dx * dx + dy * dy);
                  if (point.distance < point.radius) {
                      if (settings.moveTypeIn === 'wobble') {
                          point.sx = point.sx * settings.wobbleFactor + (mousePos.x - point.x) * settings.wobbleSpeed;
                          point.sy = point.sy * settings.wobbleFactor + (mousePos.y - point.y) * settings.wobbleSpeed;
                          point.x = point.x + point.sx;
                          point.y = point.y + point.sy;
                      } else if (settings.moveTypeIn === 'move') {
                          point.x -= (point.x - mousePos.x) / settings.moveSpeed;
                          point.y -= (point.y - mousePos.y) / settings.moveSpeed;
                      }
                  } else {
                      if (settings.moveTypeOut === 'wobble') {
                          point.sx = point.sx * settings.wobbleFactor + (point.xp - point.x) * settings.wobbleSpeed;
                          point.sy = point.sy * settings.wobbleFactor + (point.yp - point.y) * settings.wobbleSpeed;
                          point.x = point.x + point.sx;
                          point.y = point.y + point.sy;
                      } else if (settings.moveTypeOut === 'move') {
                          point.x -= (point.x - point.xp) / settings.moveSpeed;
                          point.y -= (point.y - point.yp) / settings.moveSpeed;
                      }
                  }

                  // ---
                  var pointBefor = windowPoints[i - 1];
                  var pointAfter = windowPoints[i + 1];
                  if (i > 2 && i < windowPoints.length - 2) {
                      if (pointBefor.movement) {
                          pointBefor.x = (windowPoints[i - 2].x + point.x) / 2;
                          pointBefor.y = (windowPoints[i - 2].y + point.y) / 2;
                      }
                      if (pointAfter.movement) {
                          pointAfter.x = (windowPoints[i + 2].x + point.x) / 2;
                          pointAfter.y = (windowPoints[i + 2].y + point.y) / 2;
                      }
                  }
                  ctx.quadraticCurveTo(point.x, point.y, pointAfter.x, pointAfter.y);
              }

              // ---
              if (settings.lineColor.length > 0) {
                  ctx.lineWidth = settings.lineWidth;
                  ctx.strokeStyle = settings.lineColor;
                  ctx.stroke();
              }
              if (settings.bodyColor.length > 0) {
                  ctx.fillStyle = settings.bodyColor;
                  ctx.fill();
              }
              // ctx.globalCompositeOperation = 'source-out';
              // ctx.fillStyle = "rgba(0, 0, 0, 1)";
              // ctx.fill();

              // ---
              if (settings.debug) {
                  for (i = 0, l = windowPoints.length; i < l; i++) {
                      var point = windowPoints[i];
                      if (point.visible) {
                          if (point.type === 'P') {
                              drawCircle(point.x, point.y, 3, '#FF0000');
                          } else {
                              drawCircle(point.x, point.y, 6, '#FF00FF');
                          }
                          if (point.color) {
                              drawCircle(point.x, point.y, 12, point.color);
                          }
                      }
                  }
                  ctx.strokeStyle = '#000000';
                  ctx.strokeRect(0, 0, settings.canvasWidth, settings.canvasHeight);
              }
          };

          // ---
          function delayFlag() {
              resizeCanvas();
              addWindow();
              isResizing = false;
          };

          function resize() {
              if (!isResizing) {
                  if (canvasContent.elementWidth !== object.offsetWidth || canvasContent.elementHeight !== object.offsetHeight) {
                      // -----------
                      isResizing = true;
                      canvasContent.elementWidth = object.offsetWidth;
                      canvasContent.elementHeight = object.offsetHeight;
                      // 防止闪白
                      delayId = window.setTimeout(delayFlag, 10);
                  }
              }
          };

          // ---
          function drawCircle(x, y, radius, color) {
              ctx.beginPath();
              ctx.arc(x, y, radius, 0, 2 * Math.PI);
              ctx.strokeStyle = color;
              ctx.stroke();
          };

          // ---
          function mouseMoveHandler(event) {
              mousePos = getMousePos(canvas, event);
          };

          function mouseLeaveHandler(event) {
              mousePos.x = -10000;
              mousePos.y = -10000;
          };

          // ---
          function getMousePos(canvas, event) {
              var rect = canvas.getBoundingClientRect();
              return {
                  x: event.clientX - rect.left,
                  y: event.clientY - rect.top
              };
          };

          // ---
          init();
      };


  var settings = {
        radius: 20,
        wobbleFactor: 0.98,
        wobbleSpeed: 0.05,
        moveSpeed: 3,
        lineWidth: 3,
        lineColor: '#000',
        bodyColor: '#EEE'

  };
/*
  var footers=document.querySelectorAll(".footer");
  wobbleWindow(footers[footers.length-1],{
                radius: 20,
                depth:-2,
                movementBottom: false,
                movementLeft: false,
                movementRight: false,
                debug: false
  });*/

  var postblocks=document.querySelectorAll(".main-inner .post-block ");
  [].forEach.call(postblocks, function(elm) {
      wobbleWindow(elm,settings);
  });

  

});

</script>


<!-- 页面背景图片动态加载 -->
<script>

     //获取指定长度的uuid
     function uuid(len, radix) {
        var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.split('');
        var uuid = [], i;
        radix = radix || chars.length;

        if (len) {
          // Compact form
          for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random()*radix];
        } else {
          // rfc4122, version 4 form
          var r;

          // rfc4122 requires these characters
          uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
          uuid[14] = '4';

          // Fill in random data.  At i==19 set the high bits of clock sequence as
          // per rfc4122, sec. 4.1.5
          for (i = 0; i < 36; i++) {
            if (!uuid[i]) {
              r = 0 | Math.random()*16;
              uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
            }
          }
        }

        return uuid.join('');
    }

    function animatechangbgimg(elm,opacityvalue,bgimgurl){
        $(elm).animate(
        　　{opacity:opacityvalue},
        　　"slow",
        　　null,
        　　function(){
               $(elm).css("background-image","url("+bgimgurl+")");
        　　}
        );
    }

    function checktime(time){
        var oldtime = localStorage.getItem("pjax-imgurl-leeze-lastvisitedtime");
        return Math.floor(((new Date).getTime()-oldtime)/1e3) >= time;
    }

    function changbgimgurl(){

          if(checktime(13)){//每次打开新页面，都会触发一个新的调度器，固加入lastvisitedtime校验，确保循环时间
                //var tc = "https://cdn.jsdelivr.net/gh/maplesugarr/blog-assets/imgs/body-bg/body-bg-" + Math.floor(23 * Math.random()) + ".jpg";
                //var bgimgurl = 'https://source.unsplash.com/collection/30327996/2000x1000';
                //var initbgurl = null,newbgurl = "https://cdn.jsdelivr.net/gh/leeze2012/blog-assets/img/body-bg-" + Math.floor(26 * Math.random()) + ".jpg";
                var initbgurl = null,newbgurl = "https://static.xiaosige.com/img/bg/body-bg-" + Math.floor(26 * Math.random()) + ".jpg";
                if(localStorage.hasOwnProperty('pjax-imgurl-leeze')){
                  initbgurl = localStorage.getItem("pjax-imgurl-leeze");
                }else{
                  initbgurl = newbgurl;
                }

                if($("#bg-box1").css('opacity')==="1"){
                      animatechangbgimg("#bg-box1",0,newbgurl);
                      animatechangbgimg("#bg-box2",1,initbgurl);
                }else{
                      animatechangbgimg("#bg-box1",1,initbgurl);
                      animatechangbgimg("#bg-box2",0,newbgurl);
                }

                localStorage.setItem("pjax-imgurl-leeze", newbgurl);
                localStorage.setItem("pjax-imgurl-leeze-lastvisitedtime",(new Date).getTime());
          }

    };

    setInterval(changbgimgurl,15000);

</script>

<!-- 标题文字闪烁效果 -->
<script>

document.getElementsByClassName('site-title')[0].setAttribute('data-splitting','chars');

Splitting();
gsap.set('.char', {
  '--hue': gsap.utils.distribute({
    base: 0,
    amount: 330,
  })
});
gsap.to('.char', {
  '--weight': 700,
  '--saturation': 80,
  ease: 'sine.inOut',
  duration: 0.5,
  stagger: {
    yoyo: true,
    repeat: -1,
    each: 0.15,
  }
}).time(2);
</script>


<script type="text/javascript">
    $(document).ready(function() {
        <!-- 站点作者头像 -->
        if($('.site-author:first').children().first().prop("tagName").toLowerCase() === "img"){
            <!-- 头像站点作者头像连接到关于我 -->
            $('.site-author-image').prop('outerHTML', "<a href='/about' title='关于我'>"+$('.site-author-image').prop("outerHTML")+"</a>");
            <!-- 站点作者头像动画阴影 -->
            $(".site-author-image").hover(function(){
                $(this).toggleClass('site-author-image-yy');
            },function(){
                $(this).toggleClass('site-author-image-yy');
            });
        }
        <!-- 五星好评 -->
        if($("#wpac-rating").length > 0){
            $("#wpac-rating").before("<div style='color: rgba(0, 0, 0, 0.75); font-size:13px; letter-spacing:3px'>(&gt; 看完记得五星好评哦亲 &lt;)</div>");
            $(".wp_rating").css("height","30px");
        }
        if($(".copyright").length > 0){
            <!-- footer追加邮箱 -->
            if($(".leezeEmail").length === 0){
                $(".copyright").append("<span class='leezeEmail post-meta-item'><i style='margin-right:6px;' class='fa fa-fw fa-envelope with-love'></i><a href='mailto:leeze0216@163.com' title='E-Mail → mailto:leeze0216@163.com' target='_blank'>leeze0216@163.com</a></span>");
            }
            <!-- 版权图标 -->
            $(".copyright span[class='with-love']").css("display","none");
        }
        <!-- footer的阅读次数位置调整 -->
        if($(".busuanzi-count").length > 0){
            $(".wordcount").append($(".busuanzi-count").html());
            $(".busuanzi-count").remove();
        }
        <!-- 标签页追加抖动样式 -->
        if($('.tag-cloud-tags a').length > 0){
            $('.tag-cloud-tags a').each(function(){
              $(this).addClass('shake shake-slow');
            });
        }
        <!-- 社交链接增加hover样式 -->
        if($('.links-of-author-item a').length > 0){
            $('.links-of-author-item a').each(function(index,element){
                if((index+1)%2 === 1){
                    $(this).addClass('hvr-bounce-to-right');
                }else{
                    $(this).addClass('hvr-bounce-to-left');
                }
                if($(this).children('i').length > 0){
                    $(this).children('i').addClass('faa-spin');
                }
            });
        }
        <!-- 主菜单hover样式 -->
        if($('.main-menu .menu-item a').length > 0){
            $('.main-menu .menu-item a').each(function(index,element){
                $(this).addClass('hvr-grow-shadow');
                if($(this).children('i').length > 0){
                    $(this).children('i').addClass('faa-wrench');
                }
            });
        }
        <!-- 移动端 隐藏音乐 -->
        if (/(iPhone|iPad|iPod|iOS|Android)/i.test(navigator.userAgent)) {
            $('meting-js').css('display','none');
        }

        <!-- 转载 -->
        if($('.zhuanzai').length > 0){
            $('.zhuanzai').each(function(index,element){
                $(this).hover(function(){
                    var tipmsg = this.getAttribute('href');
                    if( tipmsg === 'javascript:;'){
                        tipmsg = "抱歉，忘记转载地址了！";
                    }
                    layer.tips(tipmsg, $(this), {
                      tips: 3
                    });
                },function(){
                    layer.closeAll('tips');
                });
            });
        }

    });
</script>
<!-- 自定义 -->
<script src="/zone/js/leeze.js"></script>
<div class="moon-menu">
  <div class="moon-menu-items">
    
    <div id="moon-menu-item-back2bottom" class="moon-menu-item" onclick="back2bottom()">
      <i class='fa fa-chevron-down'></i>    </div>
    
    <div id="moon-menu-item-back2top" class="moon-menu-item" onclick="back2top()">
      <i class='fa fa-chevron-up'></i>    </div>
    
  </div>
  <div class="moon-menu-button">
    <svg class="moon-menu-bg">
      <circle class="moon-menu-cricle" cx="50%" cy="50%" r="44%"></circle>
      <circle class="moon-menu-border" cx="50%" cy="50%" r="48%"></circle>
    </svg>
    <div class="moon-menu-content">
      <div class="moon-menu-icon"><i class='fas fa-ellipsis-v'></i></div>
      <div class="moon-menu-text"></div>
    </div>
  </div>
</div><script src="/js/injector.js"></script><!-- hexo-inject:begin --><!-- hexo-inject:end -->
</body>
</html>
